提交TOB退货优化
This commit is contained in:
parent
3a36ac3550
commit
d827760a5c
|
@ -24,6 +24,10 @@ import com.hzya.frame.plugin.lets.util.DateStrUtil;
|
||||||
import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil;
|
import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil;
|
||||||
import com.hzya.frame.split.SplitListByCountUtil;
|
import com.hzya.frame.split.SplitListByCountUtil;
|
||||||
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
|
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
|
||||||
|
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto;
|
||||||
|
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto;
|
||||||
|
import com.hzya.frame.ttxofs.dto.returngoodordersearch.RerturnGoodsOrderSearchData;
|
||||||
|
import com.hzya.frame.ttxofs.dto.returngoodordersearch.RerturnGoodsOrderSearchJsonRootBean;
|
||||||
import com.hzya.frame.ttxofs.dto.returngoodsearch.RertunGoodsRootBean;
|
import com.hzya.frame.ttxofs.dto.returngoodsearch.RertunGoodsRootBean;
|
||||||
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodHeaderDetailsDataDto;
|
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodHeaderDetailsDataDto;
|
||||||
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchDetailsDto;
|
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchDetailsDto;
|
||||||
|
@ -31,6 +35,7 @@ import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchHeaderDto;
|
||||||
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
|
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
|
||||||
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
|
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
|
||||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import lombok.Data;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -153,15 +158,15 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
|
|
||||||
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
|
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
|
||||||
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||||
queryOfsSoSaleOutVo.setClosedAt_start("2024-07-16 16:44:00");
|
// queryOfsSoSaleOutVo.setClosedAt_start("2024-07-16 16:44:00");
|
||||||
queryOfsSoSaleOutVo.setClosedAt_end("2024-07-16 16:44:02");
|
// queryOfsSoSaleOutVo.setClosedAt_end("2024-07-16 16:44:02");
|
||||||
queryOfsSoSaleOutVo.setClientCode("LETS");
|
queryOfsSoSaleOutVo.setClientCode("LETS");
|
||||||
// queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
|
// queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
|
||||||
queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
|
// queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
|
||||||
// queryOfsSoSaleOutVo.setStatus(900L);
|
// queryOfsSoSaleOutVo.setStatus(900L);
|
||||||
queryOfsSoSaleOutVo.setPageNo(1L);
|
queryOfsSoSaleOutVo.setPageNo(1L);
|
||||||
queryOfsSoSaleOutVo.setPageSize(50L);
|
queryOfsSoSaleOutVo.setPageSize(50L);
|
||||||
// queryOfsSoSaleOutVo.setCode("LETS-RE2024071600000001");
|
queryOfsSoSaleOutVo.setCode("LETS-RE2024070800000001");
|
||||||
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L);
|
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L);
|
||||||
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
|
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
|
||||||
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
|
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
|
||||||
|
@ -486,6 +491,16 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader();
|
||||||
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
|
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
|
||||||
|
|
||||||
|
//通过售后订单,查询销售订单
|
||||||
|
SaleOrderMessageDto saleOrderMessageDto = queryAfterSalesOrder(header);
|
||||||
|
if (saleOrderMessageDto == null) {
|
||||||
|
Assert.state(false, "没有匹配到售后订单,系统业务无法完成");
|
||||||
|
}
|
||||||
|
HeaderDto header1 = saleOrderMessageDto.getData().get(0).getHeader();
|
||||||
|
String memberId = header1.getMemberId();
|
||||||
|
Assert.notNull(memberId, "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||||
|
Assert.state(!"".equals(memberId.trim()), "TOB销售订单(OFS)表头会员id不能为空,否则无法匹配U8C客商档案!");
|
||||||
|
|
||||||
// 销售公司、发货公司
|
// 销售公司、发货公司
|
||||||
String companyCode = header.getCompanyCode();
|
String companyCode = header.getCompanyCode();
|
||||||
Assert.notNull(companyCode, "O表头公司不能为空");
|
Assert.notNull(companyCode, "O表头公司不能为空");
|
||||||
|
@ -556,12 +571,17 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
//客商基本档案
|
//客商基本档案
|
||||||
String custName = "天猫intoyou旗舰店-自营";
|
// String custName = "天猫intoyou旗舰店-自营";
|
||||||
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
|
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
|
||||||
bdCubasdocEntity.setDataSourceCode("lets_u8c");
|
bdCubasdocEntity.setDataSourceCode("lets_u8c");
|
||||||
bdCubasdocEntity.setDr(0L);
|
bdCubasdocEntity.setDr(0L);
|
||||||
bdCubasdocEntity.setCustname(custName);
|
bdCubasdocEntity.setDef1(memberId);
|
||||||
List<BdCubasdocEntity> bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
|
List<BdCubasdocEntity> bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
|
||||||
|
if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) {
|
||||||
|
Assert.state(false, "根据OFS会员id{},无法查询到U8C客商基本档案", memberId);
|
||||||
|
} else if (bdCubasdocEntityList.size() >= 2) {
|
||||||
|
Assert.state(false, "根据OFS会员id{},无法查询到U8C客商基本档案", memberId);
|
||||||
|
}
|
||||||
|
|
||||||
//客商管理档案
|
//客商管理档案
|
||||||
BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity();
|
BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity();
|
||||||
|
@ -571,6 +591,9 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc());
|
bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc());
|
||||||
bdCumandocEntity1.setCustflags(ProfilesActiveConstant.CUSTOMER);
|
bdCumandocEntity1.setCustflags(ProfilesActiveConstant.CUSTOMER);
|
||||||
List<BdCumandocEntity> bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1);
|
List<BdCumandocEntity> bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1);
|
||||||
|
if (bdCumandocEntityList == null || bdCumandocEntityList.size() == 0) {
|
||||||
|
Assert.state(false, "根据客商基本档案主键{},没有办法查询到客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());
|
||||||
|
}
|
||||||
|
|
||||||
//查找平台
|
//查找平台
|
||||||
String platformZdyId = "0001A210000000000JUD";
|
String platformZdyId = "0001A210000000000JUD";
|
||||||
|
@ -826,4 +849,84 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
||||||
tocofsReturngoodsDetailedEntity.setBusinessType("TOB_RETURN");//业务类型
|
tocofsReturngoodsDetailedEntity.setBusinessType("TOB_RETURN");//业务类型
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据售后订单号,查询售后订单
|
||||||
|
*
|
||||||
|
* @param refOrderCode 售后订单号
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
public RerturnGoodsOrderSearchData getOfsRertunOrder(String refOrderCode) throws Exception {
|
||||||
|
Long pageSize = 200L;
|
||||||
|
Long pageNo = 1L;
|
||||||
|
|
||||||
|
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||||
|
queryOfsSoSaleOutVo.setPageNo(pageNo);
|
||||||
|
queryOfsSoSaleOutVo.setPageSize(pageSize);
|
||||||
|
queryOfsSoSaleOutVo.setCode(refOrderCode);
|
||||||
|
|
||||||
|
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
|
||||||
|
interfaceParamDto.setApi("ofs.returnOrder.search");
|
||||||
|
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
|
||||||
|
RerturnGoodsOrderSearchJsonRootBean rerturnGoodsOrderSearchJsonRootBean = (RerturnGoodsOrderSearchJsonRootBean) ofsUnifiedService.unified(interfaceParamDto);
|
||||||
|
if (rerturnGoodsOrderSearchJsonRootBean != null) {
|
||||||
|
if ("false".equals(rerturnGoodsOrderSearchJsonRootBean.getError()) && "0".equals(rerturnGoodsOrderSearchJsonRootBean.getCode()) && "Success".equals(rerturnGoodsOrderSearchJsonRootBean.getMsg())) {
|
||||||
|
List<RerturnGoodsOrderSearchData> data = rerturnGoodsOrderSearchJsonRootBean.getData();
|
||||||
|
if (data != null && data.size() > 0) {
|
||||||
|
return data.get(0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.error("查询售后订单失败,接口返回结果:{}", JSON.toJSON(rerturnGoodsOrderSearchJsonRootBean));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.error("rerturnGoodsOrderSearchJsonRootBean为空(返回结果为空),查询入参条件:{}!", JSON.toJSON(queryOfsSoSaleOutVo));
|
||||||
|
}
|
||||||
|
Assert.state(false, "根据售后订单号:{} 没有查询到OFS售后订单", refOrderCode);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询OFS销售订单
|
||||||
|
*
|
||||||
|
* @param code OFS销售订单编码
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
public SaleOrderMessageDto getOfsOrder(String code) throws Exception {
|
||||||
|
Long pageSize = 200L;
|
||||||
|
Long pageNo = 1L;
|
||||||
|
|
||||||
|
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||||
|
queryOfsSoSaleOutVo.setPageNo(pageNo);
|
||||||
|
queryOfsSoSaleOutVo.setPageSize(pageSize);
|
||||||
|
queryOfsSoSaleOutVo.setCode(code);
|
||||||
|
|
||||||
|
InterfaceParamDto interfaceParamDto = new InterfaceParamDto();
|
||||||
|
interfaceParamDto.setApi("ofs.salesOrder.search");
|
||||||
|
interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo));
|
||||||
|
SaleOrderMessageDto saleOrderMessageDto = (SaleOrderMessageDto) ofsUnifiedService.unified(interfaceParamDto);
|
||||||
|
return saleOrderMessageDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询售后订单
|
||||||
|
*
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
private SaleOrderMessageDto queryAfterSalesOrder(StockinOrderSearchResponse.StockinOrder.StockinH header) throws Exception {
|
||||||
|
if (header != null) {
|
||||||
|
//根据售后入库单、查询售后订单
|
||||||
|
RerturnGoodsOrderSearchData ofsRertunOrder = getOfsRertunOrder(header.getRefOrderCode());
|
||||||
|
if (ofsRertunOrder == null || ofsRertunOrder.getHeader() == null || ofsRertunOrder.getDetails() == null) {
|
||||||
|
Assert.state(false, "根据OFS售后订单编码{},无法查询到售后订单信息!", header.getRefOrderCode());
|
||||||
|
}
|
||||||
|
SaleOrderMessageDto ofsOrder = getOfsOrder(ofsRertunOrder.getHeader().getRefOrderCode());
|
||||||
|
if (ofsOrder == null) {
|
||||||
|
Assert.state(false, "根据OFS销售订单编码{},无法查询到销售订单信息!", ofsRertunOrder.getHeader().getRefOrderCode());
|
||||||
|
}
|
||||||
|
return ofsOrder;
|
||||||
|
} else {
|
||||||
|
logger.error("queryAfterSalesOrder方法入参为null(header为null!)");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -127,7 +127,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
||||||
queryOfsSoSaleOutVo.setCreated_end("2024-07-16 15:35:37");
|
queryOfsSoSaleOutVo.setCreated_end("2024-07-16 15:35:37");
|
||||||
queryOfsSoSaleOutVo.setClientCode("LETS");
|
queryOfsSoSaleOutVo.setClientCode("LETS");
|
||||||
// queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
|
// queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
|
||||||
queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
|
// queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
|
||||||
// queryOfsSoSaleOutVo.setStatus(900L);
|
// queryOfsSoSaleOutVo.setStatus(900L);
|
||||||
queryOfsSoSaleOutVo.setPageNo(1L);
|
queryOfsSoSaleOutVo.setPageNo(1L);
|
||||||
queryOfsSoSaleOutVo.setPageSize(50L);
|
queryOfsSoSaleOutVo.setPageSize(50L);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.hzya.frame.plugin.lets.plugin.sales;
|
package com.hzya.frame.plugin.lets.plugin.sales;
|
||||||
|
|
||||||
import com.hzya.frame.WebappApplication;
|
import com.hzya.frame.WebappApplication;
|
||||||
|
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -32,4 +33,15 @@ public class SoSaleReturnPluginInitializerToBTest {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
// public void startImplement2() {
|
||||||
|
// try {
|
||||||
|
// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
|
||||||
|
// queryOfsSoSaleOutVo.setClientCode("LETS");
|
||||||
|
// soSaleReturnPluginInitializerToB.getOfsRertunOrder(queryOfsSoSaleOutVo);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
Loading…
Reference in New Issue