提交TOB、TOC优化流程

This commit is contained in:
liuy 2024-08-19 23:29:47 +08:00
parent 629965f2a1
commit d7f0d1dddc
23 changed files with 994 additions and 196 deletions

View File

@ -31,4 +31,7 @@ public class ProfilesActiveConstant {
public static final String CUSTOMER = "'0','2'";
public static final String sourceSystem1 = "OFS订单系统";
public static final String sourceSystem2 = "丽知商城";
}

View File

@ -38,4 +38,7 @@ public class QueryOfsSoSaleOutVo {
private String closedAt_start;
private String closedAt_end;
private String storeCode;
}

View File

@ -0,0 +1,115 @@
//package com.hzya.frame.plugin.lets.plugin.purchase;
//
//import cn.hutool.core.util.StrUtil;
//import com.alibaba.fastjson.JSONObject;
//import com.hzya.frame.base.PluginBaseEntity;
//import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
//import com.hzya.frame.plugin.lets.plugin.sales.SoSaleOutPluginInitializerToB;
//import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo;
//import com.hzya.frame.plugin.lets.util.DateStrUtil;
//import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto;
//import com.hzya.frame.web.entity.JsonResultEntity;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * 代理品牌采购业务代理品牌采购OFS采购入库单生成U8C采购订单
// *
// * @Authorliuyang
// * @Packagecom.hzya.frame.plugin.lets.plugin.purchase
// * @ProjectkangarooDataCenterV3
// * @nameProxyPurchase
// * @Date2024/8/19 18:01
// * @FilenameProxyPurchase
// */
//public class ProxyPurchaseWarehous extends PluginBaseEntity {
//
// Logger logger = LoggerFactory.getLogger(ProxyPurchaseWarehous.class);
//
// @Override
// public void initialize() {
// logger.info(getPluginLabel() + "執行初始化方法initialize()");
// }
//
// @Override
// public void destroy() {
// logger.info(getPluginLabel() + "執行銷毀方法destroy()");
// }
//
// @Override
// public String getPluginId() {
// return "com.hzya.frame.plugin.lets.plugin.purchase.ProxyPurchaseWarehous";
// }
//
// @Override
// public String getPluginName() {
// return "OFS采购入库单生成U8C采购订单(代理品牌)";
// }
//
// @Override
// public String getPluginLabel() {
// return "OFS采购入库单生成U8C采购订单(代理品牌)";
// }
//
// @Override
// public String getPluginType() {
// return "3";
// }
//
// @Override
// public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
// return null;
// }
//
// /**
// * 根据指定时间范围拉取
// *
// * @author liuyang
// */
// public void startImplement(String startTime, String endTime) {
// String threadNameStr = StrUtil.format("代理品牌采购OFS采购入库单生成U8C采购订单 开始时间:{} 结束时间:{}", dateStr, summaryOrderNumber);
// logger.info(threadNameStr);
//
// Thread thread = new Thread(new Runnable() {
// @Override
// public void run() {
// try {
// CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
// String tobShop = shopTobOrToCUtil.getCommaShop("TOB");
//
// List<HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
// queryOfsSoSaleOutVo.setShipAt_start(calculateDateVo.getStart_time());
// queryOfsSoSaleOutVo.setShipAt_end(calculateDateVo.getEnd_time());
// queryOfsSoSaleOutVo.setClientCode("LETS");
// queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
//// queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
// queryOfsSoSaleOutVo.setStatus(900L);
// queryOfsSoSaleOutVo.setPageNo(1L);
// queryOfsSoSaleOutVo.setPageSize(50L);
// queryOfsSoSaleOutVo.setStoreCode(tobShop);
//// queryOfsSoSaleOutVo.setCode("LETS-SH2024010200000004");
// queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L);
// logger.info("数据返回行数:{}", headerDetailsDtoList.size());
// if (headerDetailsDtoList.size() > 0) {
// getSet(headerDetailsDtoList);
// } else {
// logger.info("没有查询到任何数据!不需要同步");
// }
// } catch (Exception e) {
// logger.error("startImplement方法抛出异常", e);
// }
// }
// }, threadNameStr);
// thread.start();
// try {
// thread.join();
// } catch (Exception e) {
// logger.error("thread.join()异常", e);
// }
// }
//
//}

View File

@ -20,9 +20,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.DateStrUtil;
import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil;
import com.hzya.frame.plugin.lets.util.TocOrderBasicArchivesCacheUtil;
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;
@ -131,6 +129,12 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
@Autowired
private IBdInvmandocDao iBdInvmandocDao;
@Autowired
private AfterSalesOrderUtil afterSalesOrderUtil;
@Autowired
private ShopTobOrToCUtil shopTobOrToCUtil;
/**
* 按指定时间拉取
*
@ -144,29 +148,25 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
@Override
public void run() {
try {
// TODO 注意过滤TOB店铺
CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
String tobShop = shopTobOrToCUtil.getCommaShop("TOB");
List<HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setShipAt_start("2024-07-05 16:38:00");
queryOfsSoSaleOutVo.setShipAt_end("2024-07-05 16:50:30");
queryOfsSoSaleOutVo.setShipAt_start(calculateDateVo.getStart_time());
queryOfsSoSaleOutVo.setShipAt_end(calculateDateVo.getEnd_time());
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
// queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop);
// queryOfsSoSaleOutVo.setCode("LETS-SH2024010200000004");
queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L);
logger.info("数据返回行数:{}", headerDetailsDtoList.size());
if (headerDetailsDtoList.size() > 0) {
//保存到mysql
batchInsert(headerDetailsDtoList);
//过滤成功的数据
List<HeaderDetailsDto> headerDetailsDtos = filterData(headerDetailsDtoList);
//执行推送主逻辑
implement(headerDetailsDtos);
getSet(headerDetailsDtoList);
} else {
logger.info("没有查询到任何数据!不需要同步");
}
@ -183,6 +183,60 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
}
}
/**
* 根据出库单单号拉取
*
* @author liuyang
*/
public void startImplement(String date) {
String threadNameStr = StrUtil.format("OFS销售出库(TOB)同步U8C销售订单 出库单单号:{}", date);
logger.info(threadNameStr);
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
String tobShop = shopTobOrToCUtil.getCommaShop("TOB");
List<HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setCode(date);
queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L);
logger.info("根据根据号拉群:数据返回行数:{}", headerDetailsDtoList.size());
if (headerDetailsDtoList.size() > 0) {
getSet(headerDetailsDtoList);
} else {
logger.info("没有查询到任何数据!不需要同步");
}
} catch (Exception e) {
logger.error("startImplement方法抛出异常", e);
}
}
}, threadNameStr);
thread.start();
try {
thread.join();
} catch (Exception e) {
logger.error("thread.join()异常", e);
}
}
private void getSet(List<HeaderDetailsDto> headerDetailsDtoList) throws Exception {
//保存到mysql
batchInsert(headerDetailsDtoList);
//过滤成功的数据
List<HeaderDetailsDto> headerDetailsDtos = filterData(headerDetailsDtoList);
//执行推送主逻辑
implement(headerDetailsDtos);
}
/**
* 过滤掉成功的数据
*
@ -506,6 +560,23 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
HeaderDto header = headerDetailsDto.getHeader();
List<DetailsDto> details = headerDetailsDto.getDetails();
//根据销售出库单查询得到销售订单
SaleOrderMessageDto saleOrderMessageDto = null;
try {
saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder(header.getRefOrderCode());
} catch (Exception e) {
logger.error("查询销售订单错误,失败原因:{}", e.getMessage());
Assert.state(false, "查询销售订单错误,失败原因:{}", e.getMessage());
}
if (saleOrderMessageDto == null) {
Assert.state(false, "没有匹配到售后订单,系统业务无法完成");
}
com.hzya.frame.ttxofs.dto.ofssalesordersearch.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();
Assert.notNull(companyCode, "O表头公司不能为空");
@ -577,24 +648,32 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
//客商基本档案
//查询OFS对应的销售订单得到会员id
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
// queryOfsSoSaleOutVo.setCode();
SaleOrderMessageDto ofsOrder = getOfsOrder(queryOfsSoSaleOutVo, 1L);
// SaleOrderMessageDto ofsOrder = getOfsOrder(queryOfsSoSaleOutVo, 1L);
String custName = "天猫intoyou旗舰店-自营";
// String custName = "天猫intoyou旗舰店-自营";
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
bdCubasdocEntity.setDataSourceCode("lets_u8c");
bdCubasdocEntity.setDr(0L);
bdCubasdocEntity.setCustname(custName);
bdCubasdocEntity.setDef1(memberId);
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();
bdCumandocEntity1.setDataSourceCode("lets_u8c");
bdCumandocEntity1.setDr(0L);
bdCumandocEntity1.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
// bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc());
bdCumandocEntity1.setCustflags(ProfilesActiveConstant.CUSTOMER);
List<BdCumandocEntity> bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1);
if (bdCumandocEntityList == null || bdCumandocEntityList.size() == 0) {
Assert.state(false, "根据客商基本档案主键{},没有办法查询到客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());
}
//查找平台
String platformZdyId = "0001A210000000000JUD";
@ -637,7 +716,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
orderOutTobHeaderDto.setDeliverGoodsCorp(bdCorpEntityList.get(0));
orderOutTobHeaderDto.setPlatformArchives(bdDefdocEntityList.get(0));
orderOutTobHeaderDto.setShopArchives(bdDefdocEntityList2.get(0));
orderOutTobHeaderDto.setOfsOrder(ofsOrder);
orderOutTobHeaderDto.setSaleOrderMessageDto(saleOrderMessageDto);
orderOutTobHeaderDto.setHeader(header);
orderOutTobHeaderDto.setDetails(details);

View File

@ -18,6 +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;
@ -27,7 +28,6 @@ import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto;
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto;
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
@ -92,9 +92,6 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
@Autowired
private TocOrderBasicArchivesCacheUtil basicArchivesCacheUtil;
@Autowired
private ITocofsSaleoutService iTocofsSaleoutService;
@Autowired
private ITocofsSaleoutDao iTocofsSaleoutDao;
@ -108,6 +105,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
private static final String ADD = "+";
@Autowired
private ShopTobOrToCUtil shopTobOrToCUtil;
/**
* 按指定时间拉取
*
@ -122,29 +122,24 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
public void run() {
LOCK.lock();
try {
// TODO 注意过滤TOC店铺
CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
String tobShop = shopTobOrToCUtil.getCommaShop("TOC");
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setShipAt_start("2024-07-05 16:38:00");
queryOfsSoSaleOutVo.setShipAt_end("2024-07-05 16:50:30");
queryOfsSoSaleOutVo.setShipAt_start(calculateDateVo.getStart_time());
queryOfsSoSaleOutVo.setShipAt_end(calculateDateVo.getEnd_time());
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
// queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop);
// queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003");
queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L);
logger.info("数据返回行数:{}", headerDetailsDtoList.size());
if (headerDetailsDtoList.size() > 0) {
//保存到mysql
batchInsert(headerDetailsDtoList);
//过滤成功的数据
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtos = filterData(headerDetailsDtoList);
//执行推送主逻辑
implement(headerDetailsDtos);
getSet(headerDetailsDtoList);
} else {
logger.info("没有查询到任何数据!不需要同步");
}
@ -168,6 +163,67 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
}
}
/**
* 按指定时间拉取
*
* @author liuyang
*/
public void startImplement(String code) {
String threadNameStr = StrUtil.format("OFS销售出库(TOC)同步U8C销售订单 出库单单据号:{}", code);
logger.info(threadNameStr);
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
LOCK.lock();
try {
String tobShop = shopTobOrToCUtil.getCommaShop("TOC");
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setCode(code);
queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L);
logger.info("数据返回行数:{}", headerDetailsDtoList.size());
if (headerDetailsDtoList.size() > 0) {
getSet(headerDetailsDtoList);
} else {
logger.info("没有查询到任何数据!不需要同步");
}
} catch (Exception e) {
logger.error("startImplement方法抛出异常", e);
} finally {
try {
basicArchivesCacheUtil.clearCache();
} catch (Exception e) {
logger.info("清理档案缓存失败", e);
}
LOCK.unlock();
}
}
}, threadNameStr);
thread.start();
try {
thread.join();
} catch (Exception e) {
logger.error("thread.join()异常", e);
}
}
private void getSet(List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtoList) throws Exception {
//保存到mysql
batchInsert(headerDetailsDtoList);
//过滤成功的数据
List<com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto> headerDetailsDtos = filterData(headerDetailsDtoList);
//执行推送主逻辑
implement(headerDetailsDtos);
}
/**
* 过滤掉成功的数据
*

View File

@ -14,28 +14,20 @@ import com.hzya.frame.plugin.lets.dao.*;
import com.hzya.frame.plugin.lets.entity.*;
import com.hzya.frame.plugin.lets.ofs.dao.ITocofsReturngoodsDao;
import com.hzya.frame.plugin.lets.ofs.dao.ITocofsReturngoodsDetailedDao;
import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDetailedDao;
import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity;
import com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsEntity;
import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo;
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo;
import com.hzya.frame.plugin.lets.u8cdto.*;
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.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.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 lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -103,9 +95,6 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
@Autowired
private IBdCalbodyDao iBdCalbodyDao;
@Autowired
private ITocofsSaleoutDetailedDao iTocofsSaleoutDetailedDao;
@Autowired
private QueryBdBusitypeUtil queryBdBusitypeUtil;
@ -115,10 +104,6 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
@Autowired
private IBdSalestruDao iBdSalestruDao;
private static final String NOTHING = "";
private static final String ADD = "+";
@Autowired
private IBdCumandocDao iBdCumandocDao;
@ -140,6 +125,15 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
@Autowired
private ITocofsReturngoodsDetailedDao iTocofsReturngoodsDetailedDao;
@Autowired
private AfterSalesOrderUtil afterSalesOrderUtil;
@Autowired
private ShopTobOrToCUtil shopTobOrToCUtil;
@Autowired
private OffsetTimeTime offsetTimeTime;
/**
* 按指定时间拉取
*
@ -153,29 +147,24 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
@Override
public void run() {
try {
// TODO 注意过滤TOB店铺
CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
//生成一个时间范围
StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
//2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性
String tobShop = shopTobOrToCUtil.getCommaShop("TOB");
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
// queryOfsSoSaleOutVo.setClosedAt_start("2024-07-16 16:44:00");
// queryOfsSoSaleOutVo.setClosedAt_end("2024-07-16 16:44:02");
queryOfsSoSaleOutVo.setClosedAt_start(startAndEndVo.getStart_time());
queryOfsSoSaleOutVo.setClosedAt_end(startAndEndVo.getEnd_time());
queryOfsSoSaleOutVo.setClientCode("LETS");
// queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
// queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
// queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setCode("LETS-RE2024070800000001");
queryOfsSoSaleOutVo.setStoreCode(tobShop);
// queryOfsSoSaleOutVo.setCode("LETS-RE2024081900000001");
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
//保存到mysql
batchInsert(returnGoodHeaderDetailsDataDtoArrayList);
//过滤成功的数据
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList);
//执行推送主逻辑
implement(stockinOrderList);
getSet(returnGoodHeaderDetailsDataDtoArrayList);
} else {
logger.info("没有查询到任何数据!不需要同步");
}
@ -192,6 +181,67 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
}
}
/**
* 按指定时间拉取
*
* @author liuyang
*/
public void startImplement(String code) {
String threadNameStr = StrUtil.format("OFS售后入库(TOB)同步U8C销售订单 售后入库单号:{}", code);
logger.info(threadNameStr);
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
//生成一个时间范围
// StartAndEndVo startAndEndVo = offsetTimeTime.offsetTime();
//2024年8月19日 15:47:51 查询出U8C里标记的店铺TOB属性
String tobShop = shopTobOrToCUtil.getCommaShop("TOB");
List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
// queryOfsSoSaleOutVo.setClosedAt_start("2002-01-01 00:00:00");// 2024年8月19日 17:13:35 仅作为接口参数验证O口头反馈根据单号查询不会启用时间范围搜索
// queryOfsSoSaleOutVo.setClosedAt_end("2002-01-01 23:59:59");
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tobShop);
queryOfsSoSaleOutVo.setCode(code);
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size());
if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) {
getSet(returnGoodHeaderDetailsDataDtoArrayList);
} else {
logger.info("没有查询到任何数据!不需要同步");
}
} catch (Exception e) {
logger.error("startImplement方法抛出异常", e);
}
}
}, threadNameStr);
thread.start();
try {
thread.join();
} catch (Exception e) {
logger.error("thread.join()异常", e);
}
}
/**
* 环境预配置
*
* @author liuyang
*/
private void getSet(List<StockinOrderSearchResponse.StockinOrder> returnGoodHeaderDetailsDataDtoArrayList) throws Exception {
//保存到mysql
batchInsert(returnGoodHeaderDetailsDataDtoArrayList);
//过滤成功的数据
List<StockinOrderSearchResponse.StockinOrder> stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList);
//执行推送主逻辑
implement(stockinOrderList);
}
/**
* 过滤掉成功的数据
*
@ -492,7 +542,14 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
List<StockinOrderSearchResponse.StockinOrder.StockinB> details = stockinOrder.getDetails();
//通过售后订单查询销售订单
SaleOrderMessageDto saleOrderMessageDto = queryAfterSalesOrder(header);
SaleOrderMessageDto saleOrderMessageDto = null;
try {
saleOrderMessageDto = afterSalesOrderUtil.queryAfterSalesOrder(header);
} catch (Exception e) {
logger.error("查询出售后订单错误,失败原因:{}", e.getMessage());
Assert.state(false, "查询出售后订单错误,失败原因:{}", e.getMessage());
}
if (saleOrderMessageDto == null) {
Assert.state(false, "没有匹配到售后订单,系统业务无法完成");
}
@ -636,6 +693,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
orderOutTobHeaderDto.setDeliverGoodsCorp(bdCorpEntityList.get(0));
orderOutTobHeaderDto.setPlatformArchives(bdDefdocEntityList.get(0));
orderOutTobHeaderDto.setShopArchives(bdDefdocEntityList2.get(0));
orderOutTobHeaderDto.setSaleOrderMessageDto(saleOrderMessageDto);
orderOutTobHeaderDto.setHeader(header);
orderOutTobHeaderDto.setDetails(details);
@ -725,6 +783,9 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
Assert.notNull(detailsDto.getSkuCode(), "O存货商家编码不能为空");
Assert.notNull(pkCorp, "发货公司主键不能为空");
//TODO 测试
detailsDto.setSkuCode("6973391730617");
BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity();
bdInvmandocEntity.setInvcode(detailsDto.getSkuCode());
bdInvmandocEntity.setPkCorp(pkCorp);
@ -849,84 +910,4 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
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方法入参为nullheader为null");
}
return null;
}
}

View File

@ -17,6 +17,7 @@ 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;
@ -103,6 +104,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
@Autowired
private TocReturnBasicArchivesCacheUtil tocReturnBasicArchivesCacheUtil;
@Autowired
private ShopTobOrToCUtil shopTobOrToCUtil;
/**
* 按指定时间拉取
*
@ -117,30 +121,26 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
public void run() {
LOCK.lock();
try {
// TODO 注意过滤TOC店铺
String tocShop = shopTobOrToCUtil.getCommaShop("TOC");
CalculateDateVo calculateDateVo = DateStrUtil.calculateCalculateEntireDayPeriod(dateStr);
List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setCreated_start("2024-07-16 15:35:35");
queryOfsSoSaleOutVo.setCreated_end("2024-07-16 15:35:37");
queryOfsSoSaleOutVo.setCreated_start(calculateDateVo.getStart_time());
queryOfsSoSaleOutVo.setCreated_end(calculateDateVo.getEnd_time());
queryOfsSoSaleOutVo.setClientCode("LETS");
// queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
// queryOfsSoSaleOutVo.setCompanyCode("SHLZ");
// queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setCode("LETS-RE2024071600000001");
queryOfsSoSaleOutVo.setStoreCode(tocShop);
// queryOfsSoSaleOutVo.setCode("LETS-RE2024071600000001");
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoList.size());
if (returnGoodHeaderDetailsDataDtoList.size() > 0) {
//保存到mysql
batchInsert(returnGoodHeaderDetailsDataDtoList);
//过滤成功的数据
List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList1 = filterData(returnGoodHeaderDetailsDataDtoList);
//执行推送主逻辑
implement(returnGoodHeaderDetailsDataDtoList1);
getSet(returnGoodHeaderDetailsDataDtoList);
} else {
logger.info("没有查询到任何数据!不需要同步");
}
@ -164,6 +164,72 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
}
}
/**
* 按指定时间拉取
*
* @author liuyang
*/
public void startImplement(String code) {
String threadNameStr = StrUtil.format("OFS销售出库(TOC)同步U8C销售订单 同步单据号:{}", code);
logger.info(threadNameStr);
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
LOCK.lock();
try {
String tocShop = shopTobOrToCUtil.getCommaShop("TOC");
List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList = new ArrayList<>();
QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo();
queryOfsSoSaleOutVo.setClientCode("LETS");
queryOfsSoSaleOutVo.setInternalInstructionType("SALES");
queryOfsSoSaleOutVo.setStatus(900L);
queryOfsSoSaleOutVo.setPageNo(1L);
queryOfsSoSaleOutVo.setPageSize(50L);
queryOfsSoSaleOutVo.setStoreCode(tocShop);
queryOfsSoSaleOutVo.setCode(code);
queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoList, 1L);
logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoList.size());
if (returnGoodHeaderDetailsDataDtoList.size() > 0) {
getSet(returnGoodHeaderDetailsDataDtoList);
} else {
logger.info("没有查询到任何数据!不需要同步");
}
} catch (Exception e) {
logger.error("startImplement方法抛出异常", e);
} finally {
try {
tocReturnBasicArchivesCacheUtil.clearCache();
} catch (Exception e) {
logger.info("清理档案缓存失败", e);
}
LOCK.unlock();
}
}
}, threadNameStr);
thread.start();
try {
thread.join();
} catch (Exception e) {
logger.error("thread.join()异常", e);
}
}
/**
* 预备执行逻辑
*
* @author liuyang
*/
private void getSet(List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList) throws Exception {
//保存到mysql
batchInsert(returnGoodHeaderDetailsDataDtoList);
//过滤成功的数据
List<ReturnGoodHeaderDetailsDataDto> returnGoodHeaderDetailsDataDtoList1 = filterData(returnGoodHeaderDetailsDataDtoList);
//执行推送主逻辑
implement(returnGoodHeaderDetailsDataDtoList1);
}
/**
* 过滤掉成功的数据
*

View File

@ -0,0 +1,121 @@
package com.hzya.frame.plugin.lets.queryvo;
public class StartAndEndVo {
/**
* 开始时间
*/
private String start_time;
/**
* 结束时间
*/
private String end_time;
/**
* 销售订单号
*/
private String src_order_no;
/**
* 退货入库单单号
*/
private String order_no;
/**
* 预入库单号
*/
private String stockinNo;
/**
* 出库单号
*/
private String stockout_no;
/**
* 店铺编码
*/
private String shop_nos;
/**
* 销售订单号
*/
private String vreceiptcode;
/**
* 业务类型
*/
private String cbiztype;
public String getCbiztype() {
return cbiztype;
}
public void setCbiztype(String cbiztype) {
this.cbiztype = cbiztype;
}
public String getVreceiptcode() {
return vreceiptcode;
}
public void setVreceiptcode(String vreceiptcode) {
this.vreceiptcode = vreceiptcode;
}
public String getShop_nos() {
return shop_nos;
}
public void setShop_nos(String shop_nos) {
this.shop_nos = shop_nos;
}
public String getStockout_no() {
return stockout_no;
}
public void setStockout_no(String stockout_no) {
this.stockout_no = stockout_no;
}
public String getStockinNo() {
return stockinNo;
}
public void setStockinNo(String stockinNo) {
this.stockinNo = stockinNo;
}
public String getOrder_no() {
return order_no;
}
public void setOrder_no(String order_no) {
this.order_no = order_no;
}
public String getSrc_order_no() {
return src_order_no;
}
public void setSrc_order_no(String src_order_no) {
this.src_order_no = src_order_no;
}
public String getStart_time() {
return start_time;
}
public void setStart_time(String start_time) {
this.start_time = start_time;
}
public String getEnd_time() {
return end_time;
}
public void setEnd_time(String end_time) {
this.end_time = end_time;
}
}

View File

@ -80,5 +80,5 @@ public class OrderOutTobHeaderDto extends HeaderDetailsDto {
/**
* OFS销售订单
*/
private SaleOrderMessageDto ofsOrder;
private SaleOrderMessageDto saleOrderMessageDto;
}

View File

@ -3,6 +3,7 @@ package com.hzya.frame.plugin.lets.u8cdto;
import com.hzya.frame.plugin.lets.entity.*;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto;
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchDetailsDto;
import com.hzya.frame.ttxofs.dto.returngoodsearch.ReturnGoodSearchHeaderDto;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
@ -91,4 +92,9 @@ public class OrderToBHeaderDto {
* TOB售后入库单表体
*/
private List<StockinOrderSearchResponse.StockinOrder.StockinB> details;
/**
* 售后订单
*/
private SaleOrderMessageDto saleOrderMessageDto;
}

View File

@ -0,0 +1,116 @@
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.plugin.lets.plugin.sales.SoSaleReturnPluginInitializerToB;
import com.hzya.frame.ttxofs.dto.InterfaceParamDto;
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.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;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.util
* @ProjectkangarooDataCenterV3
* @nameAfterSalesOrderUtil
* @Date2024/8/19 14:59
* @FilenameAfterSalesOrderUtil
*/
@Component
public class AfterSalesOrderUtil {
Logger logger = LoggerFactory.getLogger(AfterSalesOrderUtil.class);
@Autowired
private OfsUnifiedService ofsUnifiedService;
/**
* 查询售后订单
*
* @author liuyang
*/
public 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方法入参为nullheader为null");
}
return null;
}
/**
* 根据售后订单号查询售后订单
*
* @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;
}
}

View File

@ -0,0 +1,39 @@
package com.hzya.frame.plugin.lets.util;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.util
* @ProjectkangarooDataCenterV3
* @nameOffsetTimeTime
* @Date2024/8/19 16:27
* @FilenameOffsetTimeTime
*/
@Component
public class OffsetTimeTime {
/**
* 实时执行计算时间
*
* @author liuyang
*/
public StartAndEndVo offsetTime() {
StartAndEndVo startAndEndVo = new StartAndEndVo();
Date currentDate = new Date();
Date startTime = DateUtil.offset(currentDate, DateField.MINUTE, -10);
Date endTime = DateUtil.offset(currentDate, DateField.MINUTE, -2);
String startTimeStr = DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss");
String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss");
startAndEndVo.setStart_time(startTimeStr);
startAndEndVo.setEnd_time(endTimeStr);
return startAndEndVo;
}
}

View File

@ -0,0 +1,51 @@
package com.hzya.frame.plugin.lets.util;
import cn.hutool.core.lang.Assert;
import com.hzya.frame.plugin.lets.dao.IBdDefdocDao;
import com.hzya.frame.plugin.lets.entity.BdDefdocEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.util
* @ProjectkangarooDataCenterV3
* @nameShopTobOrToCUtil
* @Date2024/8/19 15:20
* @FilenameShopTobOrToCUtil
*/
@Component
public class ShopTobOrToCUtil {
@Autowired
private IBdDefdocDao iBdDefdocDao;
/**
* 查询TOB或者TOC对应的销售订单店铺
*
* @param memo TOBTOC请传这个
*/
public List<BdDefdocEntity> queryU8cShop(String memo) {
//查询U8C店铺档案
String platformZdyId2 = "0001A210000000000XZX";
BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity();
bdDefdocEntity2.setPkDefdoclist(platformZdyId2);
bdDefdocEntity2.setDr(0);
bdDefdocEntity2.setDataSourceCode("lets_u8c");
bdDefdocEntity2.setMemo(memo);
List<BdDefdocEntity> bdDefdocEntityList2 = iBdDefdocDao.query(bdDefdocEntity2);
if (bdDefdocEntityList2.size() == 0) {
Assert.state(false, "根据O店铺编码{}无法匹配到U8C店铺自定义档案 备注类型:{}", memo);
}
return bdDefdocEntityList2;
}
public String getCommaShop(String memo) {
List<BdDefdocEntity> bdDefdocEntityList = queryU8cShop(memo);
return bdDefdocEntityList.stream().map(BdDefdocEntity::getDoccode).collect(Collectors.joining(","));
}
}

View File

@ -28,7 +28,8 @@ public class SoSaleReturnPluginInitializerToBTest {
@Test
public void startImplement() {
try {
soSaleReturnPluginInitializerToB.startImplement(null, null);
// soSaleReturnPluginInitializerToB.startImplement(null, null);
soSaleReturnPluginInitializerToB.startImplement("LETS-RE2024081900000001");
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -0,0 +1,38 @@
package com.hzya.frame.plugin.lets.util;
import com.hzya.frame.WebappApplication;
import com.hzya.frame.plugin.lets.entity.BdDefdocEntity;
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 java.util.List;
import static org.junit.Assert.*;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.util
* @ProjectkangarooDataCenterV3
* @nameShopTobOrToCUtilTest
* @Date2024/8/19 15:32
* @FilenameShopTobOrToCUtilTest
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = WebappApplication.class)
public class ShopTobOrToCUtilTest {
@Autowired
private ShopTobOrToCUtil shopTobOrToCUtil;
@Test
public void queryU8cShop() {
try {
System.out.println(shopTobOrToCUtil.getCommaShop("TOC"));
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -7,6 +7,7 @@ import com.hzya.frame.ttxofs.dto.ofsBaseSearch.OfsSupplierReturnMessageDto;
import com.hzya.frame.ttxofs.dto.ofsTransferOrderSearch.OFSTranseferOrderSearchResponse;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto;
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto;
import com.hzya.frame.ttxofs.dto.returngoodordersearch.RerturnGoodsOrderSearchJsonRootBean;
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
import java.util.HashMap;
@ -35,9 +36,9 @@ public class ApiDtoCacheMap {
apiDtoCacheMap.put("ofs.store.search", new OfsShopReturnMessageDto());//店铺查询
apiDtoCacheMap.put("ofs.vendor.search", new OfsSupplierReturnMessageDto());//店铺查询
apiDtoCacheMap.put("ofs.sku.search", new OFSSKUSearchResponse());//OFS存货档案查询接口
apiDtoCacheMap.put("ofs.inventory.class.search", new OFSSKUClassSearchResponse());//OFS存货分类查询接口
apiDtoCacheMap.put("ofs.returnOrder.search", new RerturnGoodsOrderSearchJsonRootBean());//售后订单
}
}

View File

@ -1,8 +1,6 @@
package com.hzya.frame.ttxofs.basics;
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto;
import java.util.List;
import lombok.Data;
/**
* @Authorliuyang
@ -12,42 +10,10 @@ import java.util.List;
* @Date2024/7/30 11:45
* @FilenameReturnMessageBasics
*/
@Data
public class ReturnMessageBasics {
private String code;
private String msg;
private String notify;
private String error;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getNotify() {
return notify;
}
public void setNotify(String notify) {
this.notify = notify;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
}

View File

@ -97,6 +97,17 @@ public class HeaderDto {
private String isFinanical;
private String finanicalStatus;
//会员id
private String memberId;
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getId() {
return id;
}

View File

@ -0,0 +1,15 @@
package com.hzya.frame.ttxofs.dto.returngoodordersearch;
import java.util.List;
/**
* Auto-generated: 2024-08-19 11:31:49
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@lombok.Data
public class RerturnGoodsOrderSearchData {
private RerturnGoodsOrderSearchHeader header;
private List<RerturnGoodsOrderSearchDetails> details;
}

View File

@ -0,0 +1,45 @@
/**
* Copyright 2024 bejson.com
*/
package com.hzya.frame.ttxofs.dto.returngoodordersearch;
import lombok.Data;
/**
* Auto-generated: 2024-08-19 11:31:49
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
public class RerturnGoodsOrderSearchDetails {
private String clientCode;
private String companyCode;
private String storeCode;
private String id;
private String returnOrderId;
private String returnOrderCode;
private String skuCode;
private String skuName;
private String returnType;
private String refundInd;
private String requestQty;
private String fulfillQty;
private String quantityUM;
private String msrPrice;
private String listPrice;
private String totalWeight;
private String totalVolume;
private String weightUM;
private String volumeUM;
private String totalAmount;
private String sourceOrderCode;
private String sourceDiscountPrice;
private String sourcePayAmount;
private String sourceRequestQty;
private String bomType;
private String created;
private String createdBy;
private String lastUpdated;
private String lastUpdatedBy;
}

View File

@ -0,0 +1,66 @@
package com.hzya.frame.ttxofs.dto.returngoodordersearch;
import lombok.Data;
/**
* Auto-generated: 2024-08-19 11:31:49
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
public class RerturnGoodsOrderSearchHeader {
private String id;
private String clientCode;
private String companyCode;
private String storeCode;
private String facilityCode;
private String returnType;
private String exchangeType;
private String refundInd;
private String internalOrderType;
private String bizChannel;
private String code;
private String sourceUserAccount;
private String sourceUserName;
private String returnStatus;
private String shipStatus;
private String refundStatus;
private String refOrderCode;
private String refOrderId;
private String refOrderType;
private String refOrderStatusWhenReturned;
private String sourcePlatformCode;
private String sourceOrderCode;
private String returnNote;
private String requestRefundAmount;
private String actualRefundAmount;
private String totalQty;
private String totalFulfillQty;
private String shipFromAttentionTo;
private String shipFromAddress;
private String shipFromCountry;
private String shipFromState;
private String shipFromCity;
private String shipFromDistrict;
private String shipFromMobile;
private String returnCarrier;
private String returnWaybillCode;
private String auditBy;
private String auditAt;
private String refundThru;
private String csStuff;
private String errorCode;
private String errorDesc;
private String verificationStatus;
private String status;
private String created;
private String createdBy;
private String lastUpdated;
private String lastUpdatedBy;
private String processType;
private String returnNode;
private String sourceModifiedAt;
private String agNumberOfRetries;
private String realReturnReason;
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.ttxofs.dto.returngoodordersearch;
import com.hzya.frame.ttxofs.basics.ReturnMessageBasics;
import java.util.List;
import lombok.Data;
/**
* Auto-generated: 2024-08-19 11:31:49
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
public class RerturnGoodsOrderSearchJsonRootBean extends ReturnMessageBasics {
private List<RerturnGoodsOrderSearchData> data;
}

View File

@ -8,6 +8,7 @@ import lombok.Data;
import java.util.List;
/**
* 售后入库单
* Auto-generated: 2024-08-09 10:15:6
*
* @author bejson.com (i@bejson.com)