提交TOC、TOB业务优化

This commit is contained in:
liuy 2024-08-22 14:03:29 +08:00
parent 6041289293
commit 571aefd6c5
12 changed files with 609 additions and 235 deletions

View File

@ -1,6 +1,7 @@
package com.hzya.frame.plugin.lets.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* (BdRdcl)实体类
*

View File

@ -3,6 +3,7 @@ package com.hzya.frame.plugin.lets.plugin.purchase;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
@ -11,11 +12,9 @@ import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
import com.hzya.frame.plugin.lets.dao.*;
import com.hzya.frame.plugin.lets.entity.*;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
import com.hzya.frame.plugin.lets.u8cdto.PoOrderChildrenDto;
import com.hzya.frame.plugin.lets.u8cdto.PoOrderParentChildrenDto;
import com.hzya.frame.plugin.lets.u8cdto.PoOrderParentDto;
import com.hzya.frame.plugin.lets.u8cdto.PoOrderSonDto;
import com.hzya.frame.plugin.lets.u8cdto.*;
import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil;
import com.hzya.frame.plugin.lets.util.RdclUtil;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderBean;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData;
@ -28,9 +27,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.math.BigDecimal;
import java.util.*;
/**
* 代理品牌采购退货业务代理品牌采购退货OFS销退出库单生成U8C红字采购订单
@ -70,6 +68,15 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
@Autowired
private IBdInvmandocDao iBdInvmandocDao;
@Autowired
private IBdCalbodyDao iBdCalbodyDao;
@Autowired
private IBdStordocDao iBdStordocDao;
@Autowired
private RdclUtil rdclUtil;
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
@ -110,9 +117,9 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
*
* @author liuyang
*/
public void startImplement(String code) {
String threadNameStr = StrUtil.format("代理品牌采购OFS采购入库单生成U8C采购订单 售后入库单号", code);
logger.info(threadNameStr);
public void startImplement(String startTime, String endTime) {
String threadNameStrStart = StrUtil.format("开始代理品牌采退OFS采退出库单生成U8C红字采购订单 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrStart);
Thread thread = new Thread(new Runnable() {
@Override
@ -120,11 +127,12 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
try {
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClosedAt_start(startTime);
queryOfsSoSaleOutVo.setClosedAt_end(endTime);
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE_RETURN");
queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE");
queryOfsSoSaleOutVo.setStatus(900L);
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
@ -137,13 +145,58 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
logger.error("startImplement方法抛出异常", e);
}
}
}, threadNameStr);
}, threadNameStrStart);
thread.start();
try {
thread.join();
} catch (Exception e) {
logger.error("thread.join()异常", e);
}
String threadNameStrEnd = StrUtil.format("结束代理品牌采退OFS采退出库单生成U8C红字采购订单 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrEnd);
}
/**
* 根据单号查询
*
* @author liuyang
*/
public void startImplement(String code) {
String threadNameStrStart = StrUtil.format("开始代理品牌采购OFS采购入库单生成U8C采购订单 售后入库单号:{}", code);
logger.info(threadNameStrStart);
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE");
queryOfsSoSaleOutVo.setStatus(900L);
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSet(returnGoodHeaderDetailsDataDtoArrayList);
} else {
logger.info("没有查询到任何数据!不需要同步");
}
} catch (Exception e) {
logger.error("startImplement方法抛出异常", e);
}
}
}, threadNameStrStart);
thread.start();
try {
thread.join();
} catch (Exception e) {
logger.error("thread.join()异常", e);
}
String threadNameStrEnd = StrUtil.format("开始代理品牌采购OFS采购入库单生成U8C采购订单 售后入库单号:{}", code);
logger.info(threadNameStrEnd);
}
/**
@ -159,9 +212,23 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
queryOfsSoSaleOutVo.setPageSize(pageSize);
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi("ofs.shipment.search");
interfaceParamDto.setApi("ofs.receipt.search");
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
ofsUnifiedService.unified(interfaceParamDto);
StockinOrderSearchResponse rertunGoodsRootBean = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto);
if (rertunGoodsRootBean != null) {
if ("false".equals(rertunGoodsRootBean.getError()) && "0".equals(rertunGoodsRootBean.getCode()) && "Success".equals(rertunGoodsRootBean.getMsg())) {
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = rertunGoodsRootBean.getData();
if (stockinOrderList != null && stockinOrderList.size() > 0) {
headerDetailsDtoList.addAll(stockinOrderList);
//TODO OFS没有提供分页字段等待开发
}
} else {
logger.error("查询失败,失败原因:{}", JSON.toJSON(interfaceParamDto));
}
} else {
logger.error("rertunGoodsRootBean为空interfaceParamDto对象的结果集json{}", JSON.toJSON(interfaceParamDto));
}
}
/**
@ -203,6 +270,8 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
List<PoOrderSonDto> poOrderSonDtos = queryBasicArchives(returnGoodHeaderDetailsDataDtoList);
// 代理品牌采购业务流程
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow();
// 查询采购收发类别
BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("102");
if (poOrderSonDtos != null && poOrderSonDtos.size() > 0) {
for (int i = 0; i < poOrderSonDtos.size(); i++) {
@ -215,8 +284,10 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
BdCorpEntity bdCorpEntity = poOrderSonDto.getBdCorpEntity();//采购公司收货公司
BdDeptdocEntity bdDeptdocEntity = poOrderSonDto.getBdDeptdocEntity();//采购部门
BdPurorgEntity bdPurorgEntity = poOrderSonDto.getBdPurorgEntity();//采购组织
BdCubasdocEntity bdCubasdocEntity = poOrderSonDto.getBdCubasdocEntity();
BdCumandocEntity bdCumandocEntity = poOrderSonDto.getBdCumandocEntity();//客商档案-供应商
BdCubasdocEntity bdCubasdocEntity = poOrderSonDto.getBdCubasdocEntity();//客商基本档案-供应商
BdCumandocEntity bdCumandocEntity = poOrderSonDto.getBdCumandocEntity();//客商管理档案-供应商
BdCalbodyEntity bdCalbodyEntity = poOrderSonDto.getBdCalbodyEntity();//收货库存组织
BdStordocEntity bdStordocEntity = poOrderSonDto.getBdStordocEntity();//收货仓库
OfsPoOrderData ofsPoOrderData = poOrderSonDto.getOfsPoOrderData();//OFS采购订单
OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader();
@ -233,42 +304,82 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
poOrderParentDto.setDauditdate(generateBusinessDate);//审批日期
poOrderParentDto.setDorderdate(generateBusinessDate);//订单日期
poOrderParentDto.setDrevisiondate(generateBusinessDate);//修改日期
//2024年8月21日 13:34:07 对比了手工建单和接口传单发现接口传单少了这个是否由销售订单协同生成补货标志是否已协同生成销售订单 默认为N
poOrderParentDto.setBsocooptome(false);//是否由销售订单协同生成
poOrderParentDto.setBisreplenish(false);//补货标志
poOrderParentDto.setBcooptoso(false);//是否已协同生成销售订单
poOrderParentDto.setCgiveinvoicevendor(bdCumandocEntity.getPkCumandoc());//发票方id
poOrderParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统
poOrderParentDto.setVdef19(poOrderSonDto.getCode());//原单单号
poOrderParentDto.setVdef20(poOrderSonDto.getId());//原单主键
//收发类别
// poOrderParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());
// poOrderParentDto.setVdef3(bdRdclEntity.getRdname());
//采购订单明细行
List<PoOrderChildrenDto> poOrderChildrenDtoList = new ArrayList<>();
for (int j = 0; j < details.size(); j++) {
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
OfsPoOrderDetails ofsPoOrderDetail = findOfsPoOrderDetail(ofsPoOrderDataDetails, stockinB);
//TODO 测试
stockinB.setReceivedQty("1");
ofsPoOrderDetail.setFulfillAmount("10");
//2024年8月20日 16:02:21 已经和妮姐万万确认采购公司和收货公司目前是一致的暂时不用区分取数逻辑
BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCorpEntity.getPkCorp());
String receivedQty = stockinB.getReceivedQty();//实收数量
String fulfillAmount = ofsPoOrderDetail.getFulfillAmount();//实收累计总金额
//原币含税单价
BigDecimal noriginalcurprice = null;
try {
// noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
noriginalcurprice = new BigDecimal(fulfillAmount).divide(new BigDecimal(receivedQty), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP);
} catch (Exception e) {
logger.error("计算采购入库单原币含税单价失败", e);
Assert.state(false, "计算采购入库单原币含税单价失败 原因:{}", e.getMessage());
}
PoOrderChildrenDto poOrderChildrenDto = new PoOrderChildrenDto();
poOrderChildrenDto.setCmangid(bdInvmandocEntity.getPkInvmandoc());//存货管理id
poOrderChildrenDto.setNordernum(receivedQty);//订货数量
// poOrderChildrenDto.setNorgtaxprice();//原币含税单价
// poOrderChildrenDto.setPk_arrvcorp();//收货公司
// poOrderChildrenDto.setPk_arrvstoorg();//收货库存组织
// poOrderChildrenDto.setCwarehouseid();//收货仓库
poOrderChildrenDto.setNorgtaxprice(noriginalcurprice.stripTrailingZeros().toPlainString());//原币含税单价
poOrderChildrenDto.setPk_arrvcorp(bdCorpEntity.getPkCorp());//收货公司
poOrderChildrenDto.setPk_arrvstoorg(bdCalbodyEntity.getPkCalbody());//收货库存组织
poOrderChildrenDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//收货仓库
poOrderChildrenDto.setPk_reqcorp(bdCorpEntity.getPkCorp());//需求公司 *
// poOrderChildrenDto.setIisreplenish(false);//补货标识 *
poOrderChildrenDto.setCoperator("0001A110000000000U3D");//操作员id
// poOrderChildrenDto.setBreceiveplan(false);//存在到货计划
poOrderChildrenDtoList.add(poOrderChildrenDto);
//2024年8月20日 16:00:03 已经和佳妮总确认计划到货日期不用进行传递
}
List<PoOrderParentChildrenDto> poOrderParentChildrenDtoList = new ArrayList<>();
PoOrderParentChildrenDto poOrderParentChildrenDto = new PoOrderParentChildrenDto();
poOrderParentChildrenDto.setParentvo(poOrderParentDto);
poOrderParentChildrenDto.setChildrenvo(poOrderChildrenDtoList);
poOrderParentChildrenDtoList.add(poOrderParentChildrenDto);
Map<String, List<PoOrderParentChildrenDto>> stringStringMap = new HashMap<>();
stringStringMap.put("puordervo", poOrderParentChildrenDtoList);
PoOrderHeadBodyDto poOrderHeadBodyDto = sendU8CPoOrder(JSON.toJSONString(stringStringMap));
String corderid = null;
String vordercode = null;
PoOrderHeadDto parentvo = poOrderHeadBodyDto.getParentvo();
List<PoOrderBodyDto> childrenvo = poOrderHeadBodyDto.getChildrenvo();
if (parentvo != null) {
corderid = parentvo.getCorderid();
}
if (childrenvo != null) {
vordercode = parentvo.getVordercode();
}
logger.info("推送U8C代理品牌采购订单采购U8C采购订单主键{} U8C采购订单编码{}", corderid, vordercode);
}
} else {
logger.info("poOrderSonDto.size为0");
@ -338,6 +449,8 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
//2024年8月20日 14:47:55 丽知商城OFS 供应商客商档案传递到U8C的客商
//其中自定义项1作为原系统编码因此统一传到自定义项一已经和大家确认好了没有关系的放心大胆传吧宝贝
String shipFromCode = header.getShipFromCode();
Assert.notNull(shipFromCode, "O供应商编码不能为空没有办法完成业务逻辑请配置供应商编码");
Assert.state(!"".equals(shipFromCode.trim()), "O供应商编码不能为空没有办法完成业务逻辑请配置供应商编码");
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
bdCubasdocEntity.setDataSourceCode("lets_u8c");
bdCubasdocEntity.setDr(0L);
@ -363,6 +476,33 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
Assert.state(false, "根据客商基本档案主键{},匹配到多个客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());
}
// 2024年8月20日 23:51:56 收货库存组织应该是通过收货公司查询得出收货库存组织目前收货公司和采购公司保持一致那么就以采购公司带出这个逻辑已经和佳妮确认
BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity();
bdCalbodyEntity.setDr(0);
bdCalbodyEntity.setDataSourceCode("lets_u8c");
bdCalbodyEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
List<BdCalbodyEntity> bdCalbodyEntities = iBdCalbodyDao.query(bdCalbodyEntity);
if (bdCalbodyEntities.size() == 0) {
Assert.state(false, "根据U8C采购公司{}无法匹配到U8C发货库存组织", bdCorpEntityList.get(0).getPkCorp());
} else if (bdCalbodyEntities.size() >= 2) {
Assert.state(false, "根据U8C采购公司{}匹配到U8C发货库存组织{}个", bdCorpEntityList.get(0).getPkCorp(), bdCalbodyEntities.size());
}
//收货仓库
String facilityCode = header.getFacilityCode();
Assert.notNull(facilityCode, "O售后入库单仓库facilityCode字段不能为空");
BdStordocEntity bdStordocEntity = new BdStordocEntity();
bdStordocEntity.setDr(0L);
bdStordocEntity.setDataSourceCode("lets_u8c");
bdStordocEntity.setPkCalbody(bdCalbodyEntities.get(0).getPkCalbody());
bdStordocEntity.setStorcode(facilityCode);
List<BdStordocEntity> bdStordocEntityList = iBdStordocDao.query(bdStordocEntity);
if (bdStordocEntityList.size() == 0) {
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键无法匹配到U8C仓库", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
} else if (bdStordocEntityList.size() >= 2) {
Assert.state(false, "根据O仓库编码+U8C收货库存组织主键匹配到U8C仓库多个", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
}
//查询OFS采购订单
OfsPoOrderData ofsPoOrderData = queryOfsPoOrder(header.getRefOrderCode());
@ -373,8 +513,11 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
poOrderSonDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0));
poOrderSonDto.setBdCumandocEntity(bdCumandocEntityList.get(0));
poOrderSonDto.setOfsPoOrderData(ofsPoOrderData);
poOrderSonDto.setBdCalbodyEntity(bdCalbodyEntities.get(0));
poOrderSonDto.setBdStordocEntity(bdStordocEntityList.get(0));
poOrderSonDto.setDetails(details);
BeanUtil.copyPropertiesV2(poOrderSonDto, header);
BeanUtil.copyPropertiesV2(header, poOrderSonDto);
poOrderSonDtoArrayList.add(poOrderSonDto);
}
//成功
@ -409,6 +552,8 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
* @author liuyang
*/
private String createGenerateBusinessDate(PoOrderSonDto poOrderSonDto) {
//TODO 测试
poOrderSonDto.setShipAt("2024-08-19");
if (poOrderSonDto != null && poOrderSonDto.getShipAt() != null) {
String shipAt = poOrderSonDto.getShipAt();
String businessFormat = null;
@ -492,14 +637,91 @@ public class ProxyPurchaseReturn extends PluginBaseEntity {
* 查找对应的采购订单明细行
* 2024年8月20日 17:42:15
* 应该通过明细行主键匹配但是只能根据sku匹配目前的实现逻辑
* 查找OFS采购订单明细行主要是为了带出实付金额通过实付金额/实收数量=含税单价
*
* @param ofsPoOrderDataDetails OFS采购订单明细行所有对象
* @param stockinB OFS采购入库单明细行对象
* @author liuyang
*/
private void findOfsPoOrderDetail(List<OfsPoOrderDetails> ofsPoOrderDataDetails, StockinOrderSearchResponse.StockinOrder.StockinB stockinB) {
private OfsPoOrderDetails findOfsPoOrderDetail(List<OfsPoOrderDetails> ofsPoOrderDataDetails, StockinOrderSearchResponse.StockinOrder.StockinB stockinB) {
if (ofsPoOrderDataDetails != null && ofsPoOrderDataDetails.size() > 0 && stockinB != null) {
// 2024年8月20日 23:33:11 先使用sku验证然后O接口更新明细id使用明细id匹配
// 2024年8月20日 23:36:04 使用sku匹配在某种角度来说是错误的
// 2024年8月21日 14:23:02 O接口已经返回明细行主键根据这个匹配
for (int i = 0; i < ofsPoOrderDataDetails.size(); i++) {
Assert.notNull(ofsPoOrderDataDetails.get(i).getId(), "采购订单明细行主键不能为空!");
Assert.notNull(stockinB.getRefOrderDetailId(), "采购入库单明细行对应的关联采购订单的明细行主键不能为空!");
if (ofsPoOrderDataDetails.get(i).getId().equals(stockinB.getRefOrderDetailId())) {
return ofsPoOrderDataDetails.get(0);
}
}
} else {
logger.error("findOfsPoOrderDetail方法对应的ofsPoOrderDataDetails不能为空否则业务目标无法完成");
}
Assert.state(false, "无法匹配到采购订单明细行业务逻辑无法完成根据sku编码{}查找,但是在采购订单中无法匹配!", stockinB.getSkuCode());
return null;
}
/**
* 2024年8月20日 23:58:13
* 推送U8C采购订单
*
* @author liuyang
*/
public PoOrderHeadBodyDto sendU8CPoOrder(String param) throws Exception {
long startLong = System.currentTimeMillis();
logger.info("代理品牌采购推送开始,推送参数:" + param + ",U8C_URL:" + ProfilesActiveConstant.U8C_URL);
String result = HttpRequest.post(ProfilesActiveConstant.U8C_URL).header("appId", "800037")//头信息多个头信息多次调用此方法即可
.header("usercode", "admin").header("password", "21232f297a57a5a743894a0e4a801fc3").header("system", "lz").header("trantype", "PK").header("apiCode", "8000370004")//头信息多个头信息多次调用此方法即可
.header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//头信息多个头信息多次调用此方法即可
.header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息多个头信息多次调用此方法即可
.body(param)//表单内容
.timeout(20000)//超时毫秒
.execute().body();
logger.info("代理品牌采购推送结束,返回参数:" + result);
long endLong = System.currentTimeMillis();
logger.info("U8C采购订单接口请求耗时" + (endLong - startLong));
//2024年8月21日 13:17:57 如果结果返回为null则赋予""后面的处理逻辑能满足需求
if (result == null) {
result = "";
}
JSONObject jsonObject = JSON.parseObject(result);
result = String.valueOf(jsonObject.get("attribute"));
boolean isSuccess = false;
PoOrderHeadBodyDto poOrderHeadBodyDto = null;
if (result != null && !"".equals(result)) {
ReusltStrDto reusltStrDto = JSON.parseObject(result, ReusltStrDto.class);
if ("success".equals(reusltStrDto.getStatus())) {
poOrderHeadBodyDto = resultDataHandle(reusltStrDto.getData());
isSuccess = true;
}
}
if (!isSuccess) {
Assert.state(false, "代理品牌采购业务推送U8C采购订单失败 接口返回结果:{}", result);
}
return poOrderHeadBodyDto;
}
/**
* 返回结果解析处理在确认了success后调用
*
* @author liuyang
*/
private PoOrderHeadBodyDto resultDataHandle(String resultData) {
try {
if (resultData != null && !"".equals(resultData)) {
if (resultData.contains("[")) {
resultData = resultData.substring(1, resultData.length() - 1);
}
return JSON.parseObject(resultData, PoOrderHeadBodyDto.class);
}
} catch (Exception e) {
logger.error("resultDataHandle方法解析返回参数失败的错误", e);
//如果解析失败记录原因但是不能影响结果的记录
}
return null;
}
}

View File

@ -14,6 +14,7 @@ import com.hzya.frame.plugin.lets.entity.*;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
import com.hzya.frame.plugin.lets.u8cdto.*;
import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil;
import com.hzya.frame.plugin.lets.util.RdclUtil;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderBean;
import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData;
@ -73,6 +74,9 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity {
@Autowired
private IBdStordocDao iBdStordocDao;
@Autowired
private RdclUtil rdclUtil;
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
@ -114,8 +118,8 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity {
* @author liuyang
*/
public void startImplement(String startTime, String endTime) {
String threadNameStr = StrUtil.format("代理品牌采购OFS采购入库单生成U8C采购订单 售后入库单号", startTime, endTime);
logger.info(threadNameStr);
String threadNameStrStart = StrUtil.format("开始代理品牌采购OFS采购入库单生成U8C采购订单 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrStart);
Thread thread = new Thread(new Runnable() {
@Override
@ -142,13 +146,15 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity {
logger.error("startImplement方法抛出异常", e);
}
}
}, threadNameStr);
}, threadNameStrStart);
thread.start();
try {
thread.join();
} catch (Exception e) {
logger.error("thread.join()异常", e);
}
String threadNameStrEnd = StrUtil.format("结束代理品牌采购OFS采购入库单生成U8C采购订单 开始时间:{} 结束时间:{}", startTime, endTime);
logger.info(threadNameStrEnd);
}
/**
@ -263,6 +269,8 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity {
List<PoOrderSonDto> poOrderSonDtos = queryBasicArchives(returnGoodHeaderDetailsDataDtoList);
// 代理品牌采购业务流程
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow();
// 查询采购收发类别
BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("102");
if (poOrderSonDtos != null && poOrderSonDtos.size() > 0) {
for (int i = 0; i < poOrderSonDtos.size(); i++) {
@ -305,6 +313,10 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity {
poOrderParentDto.setVdef19(poOrderSonDto.getCode());//原单单号
poOrderParentDto.setVdef20(poOrderSonDto.getId());//原单主键
//收发类别
// poOrderParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());
// poOrderParentDto.setVdef3(bdRdclEntity.getRdname());
//采购订单明细行
List<PoOrderChildrenDto> poOrderChildrenDtoList = new ArrayList<>();

View File

@ -135,6 +135,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
@Autowired
private ShopTobOrToCUtil shopTobOrToCUtil;
@Autowired
private OfsStandardUtil ofsStandardUtil;
/**
* 按指定时间拉取
*
@ -163,7 +166,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop);
// queryOfsSoSaleOutVo.setCode("LETS-SH2024010200000004");
queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L);
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
logger.info("数据返回行数:{}", headerDetailsDtoList.size());
if (headerDetailsDtoList.size() > 0) {
getSet(headerDetailsDtoList);
@ -208,7 +211,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L);
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
logger.info("根据根据号拉群:数据返回行数:{}", headerDetailsDtoList.size());
if (headerDetailsDtoList.size() > 0) {
getSet(headerDetailsDtoList);
@ -302,40 +305,6 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
}
}
/**
* 查询OFS结果集
*
* @param queryOfsSoSaleOutVo 查询参数
* @param headerDetailsDtoList 查询结果集
* @param pageNo 从第pageNo页开始查询
*/
private void queryOfsSaleOrder(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<HeaderDetailsDto> headerDetailsDtoList, Long pageNo) throws Exception {
Long pageSize = 200L;
queryOfsSoSaleOutVo.setPageNo(pageNo);
queryOfsSoSaleOutVo.setPageSize(pageSize);
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi("ofs.shipment.search");
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
SaleOutReturnMessageDto saleOutReturnMessageDto = (SaleOutReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto);
if (saleOutReturnMessageDto != null) {
if ("false".equals(saleOutReturnMessageDto.getError()) && "0".equals(saleOutReturnMessageDto.getCode()) && "Success".equals(saleOutReturnMessageDto.getMsg())) {
List<HeaderDetailsDto> headerDetailsDtoList1 = saleOutReturnMessageDto.getData();
if (headerDetailsDtoList1 != null && headerDetailsDtoList1.size() > 0) {
headerDetailsDtoList.addAll(headerDetailsDtoList1);
//TODO OFS没有提供分页字段
}
} else {
//2024年7月30日 13:47:04 查询失败
logger.error("查询失败,失败原因:{}", JSON.toJSON(saleOutReturnMessageDto));
}
} else {
logger.error("returnMessageBasics为空queryOfsSoSaleOutVo对象结果{}", JSON.toJSON(queryOfsSoSaleOutVo));
}
}
// public void queryOfsSaleOrder() throws Exception {
// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
// queryOfsSoSaleOutVo.setCreated_start("2024-07-05 16:38:00");
@ -908,7 +877,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
return JSON.parseObject(resultData, SoSaleResultRootDto.class);
}
} catch (Exception e) {
e.printStackTrace();
// e.printStackTrace();
logger.error("解析返回参数失败的错误", e);
//如果解析失败记录原因但是不能影响结果的记录
}

View File

@ -18,10 +18,7 @@ import com.hzya.frame.plugin.lets.ofs.service.ITocofsSaleoutService;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo;
import com.hzya.frame.plugin.lets.u8cdto.*;
import com.hzya.frame.plugin.lets.util.ShopTobOrToCUtil;
import com.hzya.frame.plugin.lets.util.TocOrderBasicArchivesCacheUtil;
import com.hzya.frame.plugin.lets.util.DateStrUtil;
import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil;
import com.hzya.frame.plugin.lets.util.*;
import com.hzya.frame.split.SplitListByCountUtil;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto;
@ -108,6 +105,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
@Autowired
private ShopTobOrToCUtil shopTobOrToCUtil;
@Autowired
private OfsStandardUtil ofsStandardUtil;
/**
* 按指定时间拉取
*
@ -136,7 +136,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop);
// queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003");
queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L);
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
logger.info("数据返回行数:{}", headerDetailsDtoList.size());
if (headerDetailsDtoList.size() > 0) {
getSet(headerDetailsDtoList);
@ -188,7 +188,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L);
ofsStandardUtil.queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L, "ofs.shipment.search");
logger.info("数据返回行数:{}", headerDetailsDtoList.size());
if (headerDetailsDtoList.size() > 0) {
getSet(headerDetailsDtoList);
@ -296,32 +296,32 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
* @param headerDetailsDtoList 查询结果集
* @param pageNo 从第pageNo页开始查询
*/
private void queryOfsSaleOrder(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList, Long pageNo) throws Exception {
Long pageSize = 200L;
queryOfsSoSaleOutVo.setPageNo(pageNo);
queryOfsSoSaleOutVo.setPageSize(pageSize);
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi("ofs.shipment.search");
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
SaleOutReturnMessageDto saleOutReturnMessageDto = (SaleOutReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto);
if (saleOutReturnMessageDto != null) {
if ("false".equals(saleOutReturnMessageDto.getError()) && "0".equals(saleOutReturnMessageDto.getCode()) && "Success".equals(saleOutReturnMessageDto.getMsg())) {
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList1 = saleOutReturnMessageDto.getData();
if (headerDetailsDtoList1 != null && headerDetailsDtoList1.size() > 0) {
headerDetailsDtoList.addAll(headerDetailsDtoList1);
//TODO OFS没有提供分页字段
}
} else {
//2024年7月30日 13:47:04 查询失败
logger.error("查询失败,失败原因:{}", JSON.toJSON(saleOutReturnMessageDto));
}
} else {
logger.error("returnMessageBasics为空queryOfsSoSaleOutVo对象结果{}", JSON.toJSON(queryOfsSoSaleOutVo));
}
}
// private void queryOfsSaleOrder(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList, Long pageNo) throws Exception {
//
// Long pageSize = 200L;
// queryOfsSoSaleOutVo.setPageNo(pageNo);
// queryOfsSoSaleOutVo.setPageSize(pageSize);
//
// InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
// interfaceParamDto.setApi("ofs.shipment.search");
// interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
// SaleOutReturnMessageDto saleOutReturnMessageDto = (SaleOutReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto);
// if (saleOutReturnMessageDto != null) {
// if ("false".equals(saleOutReturnMessageDto.getError()) && "0".equals(saleOutReturnMessageDto.getCode()) && "Success".equals(saleOutReturnMessageDto.getMsg())) {
// List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList1 = saleOutReturnMessageDto.getData();
// if (headerDetailsDtoList1 != null && headerDetailsDtoList1.size() > 0) {
// headerDetailsDtoList.addAll(headerDetailsDtoList1);
//
// //TODO OFS没有提供分页字段
// }
// } else {
// //2024年7月30日 13:47:04 查询失败
// logger.error("查询失败,失败原因:{}", JSON.toJSON(saleOutReturnMessageDto));
// }
// } else {
// logger.error("returnMessageBasics为空queryOfsSoSaleOutVo对象结果{}", JSON.toJSON(queryOfsSoSaleOutVo));
// }
// }
// public void queryOfsSaleOrder() throws Exception {
// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();

View File

@ -134,6 +134,9 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
@Autowired
private OffsetTimeTime offsetTimeTime;
@Autowired
private OfsStandardUtil ofsStandardUtil;
/**
* 按指定时间拉取
*
@ -162,7 +165,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
// queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001");
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L);
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSet(returnGoodHeaderDetailsDataDtoArrayList);
@ -210,7 +213,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L);
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSet(returnGoodHeaderDetailsDataDtoArrayList);
@ -309,38 +312,6 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
}
}
/**
* 查询OFS售后退货入库单
*
* @param queryOfsSoSaleOutVo 查询参数
* @param headerDetailsDtoList 查询结果集
* @param pageNo 从第pageNo页开始查询
*/
private void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList, Long pageNo) throws Exception {
Long pageSize = 200L;
queryOfsSoSaleOutVo.setPageNo(pageNo);
queryOfsSoSaleOutVo.setPageSize(pageSize);
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi("ofs.receipt.search");
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
StockinOrderSearchResponse rertunGoodsRootBean = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto);
if (rertunGoodsRootBean != null) {
if ("false".equals(rertunGoodsRootBean.getError()) && "0".equals(rertunGoodsRootBean.getCode()) && "Success".equals(rertunGoodsRootBean.getMsg())) {
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = rertunGoodsRootBean.getData();
if (stockinOrderList != null && stockinOrderList.size() > 0) {
headerDetailsDtoList.addAll(stockinOrderList);
//TODO OFS没有提供分页字段等待开发
}
} else {
logger.error("查询失败,失败原因:{}", JSON.toJSON(interfaceParamDto));
}
} else {
logger.error("rertunGoodsRootBean为空interfaceParamDto对象的结果集json{}", JSON.toJSON(interfaceParamDto));
}
}
/**
* 代码同步逻辑
*

View File

@ -17,16 +17,14 @@ import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo;
import com.hzya.frame.plugin.lets.u8cdto.*;
import com.hzya.frame.plugin.lets.util.ShopTobOrToCUtil;
import com.hzya.frame.plugin.lets.util.TocReturnBasicArchivesCacheUtil;
import com.hzya.frame.plugin.lets.util.DateStrUtil;
import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil;
import com.hzya.frame.plugin.lets.util.*;
import com.hzya.frame.split.SplitListByCountUtil;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
import com.hzya.frame.ttxofs.dto.returngoodsearch.RertunGoodsRootBean;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodHeaderDetailsDataDto;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchDetailsDto;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchHeaderDto;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
@ -107,6 +105,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
@Autowired
private ShopTobOrToCUtil shopTobOrToCUtil;
@Autowired
private OfsStandardUtil ofsStandardUtil;
/**
* 按指定时间拉取
*
@ -124,13 +125,13 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
String tocShop = shopTobOrToCUtil.getCommaShop("TOC");
CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList = new ArrayList<>();
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setCreated_start(calculateDateVo.getStart_time());
queryOfsSoSaleOutVo.setCreated_end(calculateDateVo.getEnd_time());
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
//2024年8月22日 14:02:13 已经和O确认这个字段取消传递
// queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L);
@ -138,10 +139,10 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
queryOfsSoSaleOutVo.setStoreCode(tocShop);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
// queryOfsSoSaleOutVo.setCode("LETS-RE2024071600000001");
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoList.size());
if (returnGoodHeaderDetailsDataDtoList.size() > 0) {
getSet(returnGoodHeaderDetailsDataDtoList);
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search");
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSet(returnGoodHeaderDetailsDataDtoArrayList);
} else {
logger.info("没有查询到任何数据!不需要同步");
}
@ -181,7 +182,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
try {
String tocShop = shopTobOrToCUtil.getCommaShop("TOC");
List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList = new ArrayList<>();
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
@ -191,7 +192,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
queryOfsSoSaleOutVo.setStoreCode(tocShop);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSoSaleOutVo.setInternalInstructionType("RETURN");
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoList, 1L);
ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoList, 1L, "ofs.receipt.search");
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoList.size());
if (returnGoodHeaderDetailsDataDtoList.size() > 0) {
getSet(returnGoodHeaderDetailsDataDtoList);
@ -223,13 +224,13 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
*
* @author liuyang
*/
private void getSet(List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList) throws Exception {
private void getSet(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception {
//保存到mysql
batchInsert(returnGoodHeaderDetailsDataDtoList);
batchInsert(returnGoodHeaderDetailsDataDtoArrayList);
//过滤成功的数据
List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList1 = filterData(returnGoodHeaderDetailsDataDtoList);
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList);
//执行推送主逻辑
implement(returnGoodHeaderDetailsDataDtoList1);
implement(stockinOrderList);
}
/**
@ -237,11 +238,11 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
*
* @author liuyang
*/
private List<ReturnGoodHeaderDetailsDataDto> filterData(List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList) {
List<ReturnGoodHeaderDetailsDataDto> headerDetailsDtoList1 = new ArrayList<>();
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
private List<StockinOrderSearchResponse.StockinOrder> filterData(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) {
List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList1 = new ArrayList<>();
if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
//TODO 出库单明细主键需要O返回目前没有已经提需求
headerDetailsDtoList1.addAll(returnGoodHeaderDetailsDataDtoList);
headerDetailsDtoList1.addAll(returnGoodHeaderDetailsDataDtoArrayList);
}
return headerDetailsDtoList1;
}
@ -249,20 +250,20 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
/**
* 保存抓取到的数据到mysql底表如果底表里已经存在则会忽略
*
* @param returnGoodHeaderDetailsDataDtoList 数据行
* @param returnGoodHeaderDetailsDataDtoArrayList mysql数据行
*/
private void batchInsert(List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList) throws Exception {
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
List<ReturnGoodSearchHeaderDto> headerDetailsDtoList1 = new ArrayList<>();
List<ReturnGoodSearchDetailsDto> headerDetailsDtoList2 = new ArrayList<>();
private void batchInsert(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception {
if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
List<StockinOrderSearchResponse.StockinOrder.StockinH> headerDetailsDtoList1 = new ArrayList<>();
List<StockinOrderSearchResponse.StockinOrder.StockinB> headerDetailsDtoList2 = new ArrayList<>();
for (ReturnGoodHeaderDetailsDataDto index : returnGoodHeaderDetailsDataDtoList) {
ReturnGoodSearchHeaderDto header = index.getHeader();// 主表
List<ReturnGoodSearchDetailsDto> details = index.getDetails();//明细表
for (StockinOrderSearchResponse.StockinOrder index : returnGoodHeaderDetailsDataDtoArrayList) {
StockinOrderSearchResponse.StockinOrder.StockinH header = index.getHeader();// 主表
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = index.getDetails();//明细表
for (int i = 0; i < details.size(); i++) {
ReturnGoodSearchDetailsDto returnGoodSearchDetailsDto = details.get(i);
returnGoodSearchDetailsDto.setReturnGoodSearchHeaderDto(header);
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(i);
stockinB.setReturnGoodSearchHeaderDto(header);
}
headerDetailsDtoList1.add(header);
@ -270,10 +271,10 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
}
//每250作为一个批次插入主表根据主键id判断是否重复如果重复的则不进行插入
List<List<ReturnGoodSearchHeaderDto>> lists = SplitListByCountUtil.splitListByCount(headerDetailsDtoList1, 100);
List<List<StockinOrderSearchResponse.StockinOrder.StockinH>> lists = SplitListByCountUtil.splitListByCount(headerDetailsDtoList1, 100);
for (int i = 0; i < lists.size(); i++) {
List<ReturnGoodSearchHeaderDto> returnGoodSearchHeaderDtos = lists.get(i);
List<TocofsReturngoodsEntity> tocofsReturngoodsEntities = copyHeaderDto(returnGoodSearchHeaderDtos);
List<StockinOrderSearchResponse.StockinOrder.StockinH> stockinHS = lists.get(i);
List<TocofsReturngoodsEntity> tocofsReturngoodsEntities = copyHeaderDto(stockinHS);
if (tocofsReturngoodsEntities.size() > 0) {
logger.info("插入底表{}个对象(表头)", tocofsReturngoodsEntities.size());
iTocofsReturngoodsDao.entityInsertBatchV2(tocofsReturngoodsEntities);
@ -283,10 +284,10 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
}
//插入明细表
List<List<ReturnGoodSearchDetailsDto>> lists1 = SplitListByCountUtil.splitListByCount(headerDetailsDtoList2, 100);
List<List<StockinOrderSearchResponse.StockinOrder.StockinB>> lists1 = SplitListByCountUtil.splitListByCount(headerDetailsDtoList2, 100);
for (int i = 0; i < lists1.size(); i++) {
List<ReturnGoodSearchDetailsDto> returnGoodSearchDetailsDtos = lists1.get(i);
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntities = copyDetailsDto(returnGoodSearchDetailsDtos);
List<StockinOrderSearchResponse.StockinOrder.StockinB> stockinBS = lists1.get(i);
List<TocofsReturngoodsDetailedEntity> tocofsReturngoodsDetailedEntities = copyDetailsDto(stockinBS);
if (tocofsReturngoodsDetailedEntities.size() > 0) {
logger.info("插入底表{}个对象(表体)", tocofsReturngoodsDetailedEntities.size());
iTocofsReturngoodsDetailedDao.entityInsertBatchV2(tocofsReturngoodsDetailedEntities);
@ -304,31 +305,31 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
* @param headerDetailsDtoList 查询结果集
* @param pageNo 从第pageNo页开始查询
*/
private void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<ReturnGoodHeaderDetailsDataDto> headerDetailsDtoList, Long pageNo) throws Exception {
Long pageSize = 200L;
queryOfsSoSaleOutVo.setPageNo(pageNo);
queryOfsSoSaleOutVo.setPageSize(pageSize);
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi("ofs.receipt.search");
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
RertunGoodsRootBean rertunGoodsRootBean = (RertunGoodsRootBean) ofsUnifiedService.unified(interfaceParamDto);
if (rertunGoodsRootBean != null) {
if ("false".equals(rertunGoodsRootBean.getError()) && "0".equals(rertunGoodsRootBean.getCode()) && "Success".equals(rertunGoodsRootBean.getMsg())) {
List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList = rertunGoodsRootBean.getData();
if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
headerDetailsDtoList.addAll(returnGoodHeaderDetailsDataDtoList);
//TODO OFS没有提供分页字段等待开发
}
} else {
logger.error("查询失败,失败原因:{}", JSON.toJSON(interfaceParamDto));
}
} else {
logger.error("rertunGoodsRootBean为空interfaceParamDto对象的结果集json{}", JSON.toJSON(interfaceParamDto));
}
}
// private void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<ReturnGoodHeaderDetailsDataDto> headerDetailsDtoList, Long pageNo) throws Exception {
//
// Long pageSize = 200L;
// queryOfsSoSaleOutVo.setPageNo(pageNo);
// queryOfsSoSaleOutVo.setPageSize(pageSize);
//
// InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
// interfaceParamDto.setApi("ofs.receipt.search");
// interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
// RertunGoodsRootBean rertunGoodsRootBean = (RertunGoodsRootBean) ofsUnifiedService.unified(interfaceParamDto);
// if (rertunGoodsRootBean != null) {
// if ("false".equals(rertunGoodsRootBean.getError()) && "0".equals(rertunGoodsRootBean.getCode()) && "Success".equals(rertunGoodsRootBean.getMsg())) {
// List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList = rertunGoodsRootBean.getData();
// if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) {
// headerDetailsDtoList.addAll(returnGoodHeaderDetailsDataDtoList);
//
// //TODO OFS没有提供分页字段等待开发
// }
// } else {
// logger.error("查询失败,失败原因:{}", JSON.toJSON(interfaceParamDto));
// }
// } else {
// logger.error("rertunGoodsRootBean为空interfaceParamDto对象的结果集json{}", JSON.toJSON(interfaceParamDto));
// }
// }
// public void queryOfsSaleOrder() throws Exception {
// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
@ -352,10 +353,10 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
/**
* 代码同步逻辑
*
* @param returnGoodHeaderDetailsDataDtoList1 查询得到的O库单对象
* @param returnGoodHeaderDetailsDataDtoList1 查询得到的O售后入库单对象
* @author liuyang
*/
private void implement(List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList1) throws Exception {
private void implement(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList1) throws Exception {
if (returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) {
try {
// 查询基本档案
@ -372,7 +373,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
String keyGroup = entry.getKey();
List<GoodsRertunSonDetailsDto> oldValue = entry.getValue();
ReturnGoodSearchHeaderDto header = oldValue.get(0).getHeader();
StockinOrderSearchResponse.StockinOrder.StockinH header = oldValue.get(0).getHeader();
BdCorpEntity bdCorpEntity = oldValue.get(0).getBdCorpEntity();//表头销售公司
BdCorpEntity deliverGoodsCorp = oldValue.get(0).getDeliverGoodsCorp();//发货公司
BdCalbodyEntity bdCalbodyEntity = oldValue.get(0).getBdCalbodyEntity();//发货仓库组织
@ -511,7 +512,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
*
* @author liuyang
*/
private String createGenerateBusinessDate(ReturnGoodSearchHeaderDto header) {
private String createGenerateBusinessDate(StockinOrderSearchResponse.StockinOrder.StockinH header) {
if (header != null && header.getCheckInTo() != null) {
//TOC以出库日期作为业务日期
String checkInTo = header.getCheckInTo();
@ -532,11 +533,12 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
}
/**
* 档案转换
* 档案转换(OFS->U8C)
*
* @param returnGoodHeaderDetailsDataDtoList1 OFS售后入库单对象
* @author liuyang
*/
private List<GoodsRertunSonDetailsDto> queryBasicArchives(List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList1) {
private List<GoodsRertunSonDetailsDto> queryBasicArchives(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoList1) {
List<GoodsRertunSonDetailsDto> sonDetailsDtoList = new ArrayList<>();
if (returnGoodHeaderDetailsDataDtoList1 != null && returnGoodHeaderDetailsDataDtoList1.size() > 0) {
@ -545,9 +547,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
tocReturnBasicArchivesCacheUtil.initCache();
for (int i = 0; i < returnGoodHeaderDetailsDataDtoList1.size(); i++) {
ReturnGoodHeaderDetailsDataDto returnGoodHeaderDetailsDataDto = returnGoodHeaderDetailsDataDtoList1.get(i);
ReturnGoodSearchHeaderDto header = returnGoodHeaderDetailsDataDto.getHeader();
List<ReturnGoodSearchDetailsDto> details = returnGoodHeaderDetailsDataDto.getDetails();
StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList1.get(i);
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
//表头公司通过名称匹配U8C公司
// String corpName = "上海丽知品牌管理有限公司";
@ -606,7 +608,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
//字段拷贝
for (int j = 0; j < details.size(); j++) {
ReturnGoodSearchDetailsDto returnGoodSearchDetailsDto = details.get(j);
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
//2024年8月6日 10:16:22 通过O出库单的表头查询得出U8C档案放在表体的原因是方便分组汇总
//下一个步骤的分组汇总是通过表体明细完成的
@ -624,7 +626,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
goodsRertunSonDetailsDto.setBdCubasdocEntity(bdCubasdocEntity);
goodsRertunSonDetailsDto.setPlatformArchives(bdDefdocEntity);
BeanUtil.copyPropertiesV2(returnGoodSearchDetailsDto, goodsRertunSonDetailsDto);
BeanUtil.copyPropertiesV2(stockinB, goodsRertunSonDetailsDto);
sonDetailsDtoList.add(goodsRertunSonDetailsDto);
}
}
@ -640,41 +642,40 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
}
/**
* bean copy
* 对象拷贝 bean copy
* 2024年8月9日 11:23:57
*/
private List<TocofsReturngoodsEntity> copyHeaderDto(List<ReturnGoodSearchHeaderDto> returnGoodSearchHeaderDtos) {
private List<TocofsReturngoodsEntity> copyHeaderDto(List<StockinOrderSearchResponse.StockinOrder.StockinH> stockinHS) {
List<TocofsReturngoodsEntity> tocofsReturngoodsEntityArrayList = new ArrayList<>();
if (returnGoodSearchHeaderDtos != null && returnGoodSearchHeaderDtos.size() > 0) {
for (int i = 0; i < returnGoodSearchHeaderDtos.size(); i++) {
ReturnGoodSearchHeaderDto headerDto = returnGoodSearchHeaderDtos.get(i);
if (stockinHS != null && stockinHS.size() > 0) {
for (int i = 0; i < stockinHS.size(); i++) {
StockinOrderSearchResponse.StockinOrder.StockinH stockinH = stockinHS.get(i);
TocofsReturngoodsEntity tocofsReturngoodsEntity = new TocofsReturngoodsEntity();
BeanUtil.copyPropertiesV2(headerDto, tocofsReturngoodsEntity);
BeanUtil.copyPropertiesV2(stockinH, tocofsReturngoodsEntity);
tocofsReturngoodsEntityArrayList.add(tocofsReturngoodsEntity);
}
} else {
logger.info("需要复制{}个bean对象(O表头)", returnGoodSearchHeaderDtos.size());
logger.info("需要复制{}个bean对象(O表头)", stockinHS.size());
}
return tocofsReturngoodsEntityArrayList;
}
/**
* bean copy
* 对象拷贝 bean copy
* 2024年8月9日 11:24:01
*/
private List<TocofsReturngoodsDetailedEntity> copyDetailsDto(List<ReturnGoodSearchDetailsDto> headerDetailsDtoList2) {
private List<TocofsReturngoodsDetailedEntity> copyDetailsDto(List<StockinOrderSearchResponse.StockinOrder.StockinB> stockinBS) {
List<TocofsReturngoodsDetailedEntity> tocofsSaleoutDetailedEntityArrayList = new ArrayList<>();
if (headerDetailsDtoList2 != null && headerDetailsDtoList2.size() > 0) {
for (int i = 0; i < headerDetailsDtoList2.size(); i++) {
ReturnGoodSearchDetailsDto returnGoodSearchDetailsDto = headerDetailsDtoList2.get(i);
if (stockinBS != null && stockinBS.size() > 0) {
for (int i = 0; i < stockinBS.size(); i++) {
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = stockinBS.get(i);
//表头
ReturnGoodSearchHeaderDto returnGoodSearchHeaderDto = returnGoodSearchDetailsDto.getReturnGoodSearchHeaderDto();
StockinOrderSearchResponse.StockinOrder.StockinH returnGoodSearchHeaderDto = stockinB.getReturnGoodSearchHeaderDto();
TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity();
// tocofsReturngoodsDetailedEntity.setBusinessType("TOC_RETURN");
BeanUtil.copyPropertiesV2(returnGoodSearchDetailsDto, tocofsReturngoodsDetailedEntity);
BeanUtil.copyPropertiesV2(stockinB, tocofsReturngoodsDetailedEntity);
createPrimaryKeyAndBusinessDateAndBusinessType(tocofsReturngoodsDetailedEntity, returnGoodSearchHeaderDto);
tocofsSaleoutDetailedEntityArrayList.add(tocofsReturngoodsDetailedEntity);
}
@ -694,7 +695,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
for (int i = 0; i < goodsRertunSonDetailsDtos.size(); i++) {
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = goodsRertunSonDetailsDtos.get(i);
//2024年8月6日 10:35:25表头对象用于带出表头相关的分组汇总信息
ReturnGoodSearchHeaderDto header = goodsRertunSonDetailsDto.getHeader();
StockinOrderSearchResponse.StockinOrder.StockinH header = goodsRertunSonDetailsDto.getHeader();
//公司
BdCorpEntity bdCorpEntity = goodsRertunSonDetailsDto.getBdCorpEntity();
@ -925,8 +926,11 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
/**
* 填充主表主键业务日期业务类型
* 2024年8月15日 17:31:54
*
* @param tocofsReturngoodsDetailedEntity dao明细行对象
* @param returnGoodSearchHeaderDto OFS售后入库单表头对象
*/
private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity, ReturnGoodSearchHeaderDto returnGoodSearchHeaderDto) {
private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity, StockinOrderSearchResponse.StockinOrder.StockinH returnGoodSearchHeaderDto) {
if (tocofsReturngoodsDetailedEntity != null && returnGoodSearchHeaderDto != null) {
tocofsReturngoodsDetailedEntity.setPrimaryKey(tocofsReturngoodsDetailedEntity.getId());//主表主键
tocofsReturngoodsDetailedEntity.setBusinessDate(returnGoodSearchHeaderDto.getCheckInFrom());//业务日期

View File

@ -4,6 +4,7 @@ import com.hzya.frame.plugin.lets.entity.*;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchDetailsDto;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchHeaderDto;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import lombok.Data;
import java.math.BigDecimal;
@ -17,12 +18,12 @@ import java.math.BigDecimal;
* @FilenameSonDetailsDto
*/
@Data
public class GoodsRertunSonDetailsDto extends ReturnGoodSearchDetailsDto {
public class GoodsRertunSonDetailsDto extends StockinOrderSearchResponse.StockinOrder.StockinB {
/**
* 表头对象
*/
private ReturnGoodSearchHeaderDto header;
private StockinOrderSearchResponse.StockinOrder.StockinH header;
/**
* 表头公司销售公司

View File

@ -0,0 +1,114 @@
package com.hzya.frame.plugin.lets.util;
import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSON;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* OFS标准接口查询业务区分类
*
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.util
* @ProjectkangarooDataCenterV3
* @nameOfsStandardUtil
* @Date2024/8/22 13:30
* @FilenameOfsStandardUtil
*/
@Component
public class OfsStandardUtil {
Logger logger = LoggerFactory.getLogger(OfsStandardUtil.class);
@Autowired
private OfsUnifiedService ofsUnifiedService;
/**
* OFS出库单查询
*
* @param queryOfsSoSaleOutVo 接口查询入参
* @param headerDetailsDtoList 收集对象
* @param pageNo 从第几页开始查询
* @param api api接口名称
* @author liuyang
*/
public void queryOfsSaleOrder(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<HeaderDetailsDto> headerDetailsDtoList, Long pageNo, String api) throws Exception {
Assert.notNull(queryOfsSoSaleOutVo, "queryOfsSoSaleOutVo不能为空");
Assert.notNull(headerDetailsDtoList, "headerDetailsDtoList不能为空");
Assert.notNull(pageNo, "pageNo不能为空");
Assert.notNull(api, "api不能为空");
Long pageSize = 200L;
queryOfsSoSaleOutVo.setPageNo(pageNo);
queryOfsSoSaleOutVo.setPageSize(pageSize);
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi(api);
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
SaleOutReturnMessageDto saleOutReturnMessageDto = (SaleOutReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto);
if (saleOutReturnMessageDto != null) {
if ("false".equals(saleOutReturnMessageDto.getError()) && "0".equals(saleOutReturnMessageDto.getCode()) && "Success".equals(saleOutReturnMessageDto.getMsg())) {
List<HeaderDetailsDto> headerDetailsDtoList1 = saleOutReturnMessageDto.getData();
if (headerDetailsDtoList1 != null && headerDetailsDtoList1.size() > 0) {
headerDetailsDtoList.addAll(headerDetailsDtoList1);
//TODO OFS没有提供分页字段
}
} else {
//2024年7月30日 13:47:04 查询失败
logger.error("查询失败,失败原因:{}", JSON.toJSON(saleOutReturnMessageDto));
}
} else {
logger.error("returnMessageBasics为空queryOfsSoSaleOutVo对象结果{}", JSON.toJSON(queryOfsSoSaleOutVo));
}
}
/**
* OFS入库单查询
*
* @param queryOfsSoSaleOutVo 接口入参
* @param headerDetailsDtoList 收集对象
* @param pageNo 从第几页开始查询
* @param api api接口名称
* @author liuyang
*/
public void queryOfsReturnGoods(QueryOfsSoSaleOutVo queryOfsSoSaleOutVo, List<StockinOrderSearchResponse.StockinOrder> headerDetailsDtoList, Long pageNo, String api) throws Exception {
Assert.notNull(queryOfsSoSaleOutVo, "queryOfsSoSaleOutVo不能为空");
Assert.notNull(headerDetailsDtoList, "headerDetailsDtoList不能为空");
Assert.notNull(pageNo, "pageNo不能为空");
Assert.notNull(api, "api不能为空");
Long pageSize = 200L;
queryOfsSoSaleOutVo.setPageNo(pageNo);
queryOfsSoSaleOutVo.setPageSize(pageSize);
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
interfaceParamDto.setApi(api);
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
StockinOrderSearchResponse rertunGoodsRootBean = (StockinOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto);
if (rertunGoodsRootBean != null) {
if ("false".equals(rertunGoodsRootBean.getError()) && "0".equals(rertunGoodsRootBean.getCode()) && "Success".equals(rertunGoodsRootBean.getMsg())) {
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = rertunGoodsRootBean.getData();
if (stockinOrderList != null && stockinOrderList.size() > 0) {
headerDetailsDtoList.addAll(stockinOrderList);
//TODO OFS没有提供分页字段等待开发
}
} else {
logger.error("查询失败,失败原因:{}", JSON.toJSON(interfaceParamDto));
}
} else {
logger.error("rertunGoodsRootBean为空interfaceParamDto对象的结果集json{}", JSON.toJSON(interfaceParamDto));
}
}
}

View File

@ -0,0 +1,46 @@
package com.hzya.frame.plugin.lets.util;
import cn.hutool.core.lang.Assert;
import com.hzya.frame.plugin.lets.dao.IBdRdclDao;
import com.hzya.frame.plugin.lets.entity.BdRdclEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.util
* @ProjectkangarooDataCenterV3
* @nameRdclUtil
* @Date2024/8/21 15:10
* @FilenameRdclUtil
*/
@Component
public class RdclUtil {
@Autowired
private IBdRdclDao iBdRdclDao;
/**
* 查询收发类别
*
* @author liuyang
*/
public BdRdclEntity queryRdClObject(String code) {
Assert.notNull(code, "收发类别编码不能为空");
Assert.state(!"".equals(code.trim()), "收发类别编码不能为空");
BdRdclEntity bdRdclEntity = new BdRdclEntity();
bdRdclEntity.setDr(0);
bdRdclEntity.setRdcode(code);
bdRdclEntity.setDataSourceCode("lets_u8c");
List<BdRdclEntity> bdRdclEntityList = iBdRdclDao.query(bdRdclEntity);
if (bdRdclEntityList == null || bdRdclEntityList.size() == 0) {
Assert.state(false, "无法查询到U8C收发类别 收发类别编码:{}", code);
} else if (bdRdclEntityList.size() >= 2) {
Assert.state(false, "无询到{}个U8C收发类别存在歧义 收发类别编码:{}", bdRdclEntityList.size(), code);
}
return bdRdclEntityList.get(0);
}
}

View File

@ -32,7 +32,7 @@ public class SoSaleOutPluginInitializerToBTest {
@Test
public void startImplement() {
// soSaleOutPluginInitializerToB.startImplement(null, null);
soSaleOutPluginInitializerToB.startImplement("LETS-SH2024010900000008");
soSaleOutPluginInitializerToB.startImplement("LETS-SH2024082100000005");
// try {
// SaleOrderMessageDto ofsOrder = afterSalesOrderUtil.getOfsOrder("LETS-SO2024081600000050");

View File

@ -0,0 +1,34 @@
package com.hzya.frame.plugin.lets.util;
import com.alibaba.fastjson.JSON;
import com.hzya.frame.WebappApplication;
import com.hzya.frame.plugin.lets.entity.BdRdclEntity;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.util
* @ProjectkangarooDataCenterV3
* @nameRdclUtilTest
* @Date2024/8/21 15:16
* @FilenameRdclUtilTest
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = WebappApplication.class)
public class RdclUtilTest {
@Autowired
private RdclUtil rdclUtil;
@Test
public void queryRdClObject() {
BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("203");
System.out.println(JSON.toJSONString(bdRdclEntity));
}
}