fix(buildpackage): 修复字符串空值和前后空格问题
- 在多个地方添加了对字符串空值的校验,避免NullPointerException- 使用trim()方法去除字符串前后空格,提高数据匹配准确性- 优化了部分代码结构,增加了可读性和健壮性
This commit is contained in:
parent
907eefe710
commit
017ea3ee82
|
@ -435,7 +435,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
Assert.notNull(detailsDto.getId(), "O明细主键不能为空!");
|
||||
Assert.state(!"".equals(detailsDto.getId()), "O明细主键不能为空!");
|
||||
|
||||
idStr.append("'");
|
||||
idStr.append(detailsDto.getId());
|
||||
idStr.append("'");
|
||||
idStr.append(",");
|
||||
}
|
||||
}
|
||||
|
@ -1017,7 +1019,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
BdCorpEntity bdCorpEntity = new BdCorpEntity();
|
||||
bdCorpEntity.setDr(0);
|
||||
bdCorpEntity.setDataSourceCode("lets_u8c");
|
||||
bdCorpEntity.setUnitcode(companyCode);
|
||||
bdCorpEntity.setUnitcode(companyCode.trim());
|
||||
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
|
||||
if (bdCorpEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O货主编码{},无法匹配到U8C销售公司", companyCode);
|
||||
|
@ -1039,12 +1041,13 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
|
||||
// 仓库
|
||||
String facilityCode = header.getFacilityCode();
|
||||
// Assert.notNull(facilityCode, "facilityCode不能为空");
|
||||
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);
|
||||
bdStordocEntity.setStorcode(facilityCode.trim());
|
||||
List<BdStordocEntity> bdStordocEntityList = iBdStordocDao.query(bdStordocEntity);
|
||||
if (bdStordocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O仓库编码+U8C发货库存组织主键,无法匹配到U8C仓库 仓库编码:{} 组织机构主键:{} 发货库存组织名称:{}", facilityCode, bdCalbodyEntities.get(0).getPkCalbody(), bdCalbodyEntities.get(0).getBodyname());
|
||||
|
@ -1110,7 +1113,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
|
||||
bdCubasdocEntity.setDataSourceCode("lets_u8c");
|
||||
bdCubasdocEntity.setDr(0L);
|
||||
bdCubasdocEntity.setDef1(memberId);
|
||||
bdCubasdocEntity.setDef1(memberId.trim());
|
||||
List<BdCubasdocEntity> bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
|
||||
if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据OFS会员id:{},无法查询到U8C客商基本档案", memberId);
|
||||
|
@ -1134,11 +1137,12 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
// String platformZdyId = "0001A210000000000JUD";
|
||||
String platformZdyId = OverallConstant.getOverAllValue("u8c自定义项档案-平台主键");
|
||||
String sourcePlatformCode = header.getSourcePlatformCode();
|
||||
Assert.notNull(sourcePlatformCode, "sourcePlatformCode不能为空");
|
||||
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
|
||||
bdDefdocEntity.setPkDefdoclist(platformZdyId);
|
||||
bdDefdocEntity.setDr(0);
|
||||
bdDefdocEntity.setDataSourceCode("lets_u8c");
|
||||
bdDefdocEntity.setDoccode(sourcePlatformCode);
|
||||
bdDefdocEntity.setDoccode(sourcePlatformCode.trim());
|
||||
List<BdDefdocEntity> bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
|
||||
if (bdDefdocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O平台编码{},无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId);
|
||||
|
@ -1149,11 +1153,12 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
//查询U8C店铺档案
|
||||
String platformZdyId2 = OverallConstant.getOverAllValue("u8c自定义项档案-店铺主键");
|
||||
String ofsStoreCode = header.getStoreCode();
|
||||
Assert.notNull(ofsStoreCode, "ofsStoreCode不能为空");
|
||||
BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity();
|
||||
bdDefdocEntity2.setPkDefdoclist(platformZdyId2);
|
||||
bdDefdocEntity2.setDr(0);
|
||||
bdDefdocEntity2.setDataSourceCode("lets_u8c");
|
||||
bdDefdocEntity2.setDoccode(ofsStoreCode);
|
||||
bdDefdocEntity2.setDoccode(ofsStoreCode.trim());
|
||||
List<BdDefdocEntity> bdDefdocEntityList2 = iBdDefdocDao.query(bdDefdocEntity2);
|
||||
if (bdDefdocEntityList2.size() == 0) {
|
||||
Assert.state(false, "根据O店铺编码{},无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId);
|
||||
|
@ -1475,7 +1480,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
}
|
||||
SaleOrderMessageDto saleOrderMessageDto = null;
|
||||
try {
|
||||
saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder(refOrderCode);
|
||||
saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder(refOrderCode.trim());
|
||||
} catch (Exception e) {
|
||||
logger.error("查询销售订单错误,失败原因:{}", e.getMessage());
|
||||
Assert.state(false, "查询销售订单错误,失败原因:{}", e.getMessage());
|
||||
|
@ -1510,11 +1515,13 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
Assert.notNull(bdRdclEntity, "根据收发类别编码:{} 无法匹配到U8C收发类别");
|
||||
|
||||
//2024年8月28日 11:01:07 查询对应的U8C销售订单
|
||||
Assert.notNull(header.getCode(), "code不能为空");
|
||||
Assert.notNull(header.getId(), "id不能为空");
|
||||
SoSaleEntity soSaleEntity = new SoSaleEntity();
|
||||
soSaleEntity.setDr(0L);
|
||||
soSaleEntity.setDataSourceCode("lets_u8c");
|
||||
soSaleEntity.setVdef19(header.getCode());
|
||||
soSaleEntity.setVdef20(header.getId());
|
||||
soSaleEntity.setVdef19(header.getCode().trim());
|
||||
soSaleEntity.setVdef20(header.getId().trim());
|
||||
soSaleEntity.setBretinvflag("N");//仅查询销售订单
|
||||
List<SoSaleEntity> soSaleEntityList = iSoSaleDao.query(soSaleEntity);
|
||||
if (soSaleEntityList == null || soSaleEntityList.size() == 0) {
|
||||
|
@ -1570,7 +1577,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
BdCorpEntity bdCorpEntity = new BdCorpEntity();
|
||||
bdCorpEntity.setDr(0);
|
||||
bdCorpEntity.setDataSourceCode("lets_u8c");
|
||||
bdCorpEntity.setUnitcode(companyCode);
|
||||
bdCorpEntity.setUnitcode(companyCode.trim());
|
||||
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
|
||||
if (bdCorpEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O货主编码{},无法匹配到U8C销售公司", companyCode);
|
||||
|
@ -1597,7 +1604,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
bdStordocEntity.setDr(0L);
|
||||
bdStordocEntity.setDataSourceCode("lets_u8c");
|
||||
bdStordocEntity.setPkCalbody(bdCalbodyEntities.get(0).getPkCalbody());
|
||||
bdStordocEntity.setStorcode(facilityCode);
|
||||
bdStordocEntity.setStorcode(facilityCode.trim());
|
||||
List<BdStordocEntity> bdStordocEntityList = iBdStordocDao.query(bdStordocEntity);
|
||||
if (bdStordocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O仓库编码+U8C发货库存组织主键,无法匹配到U8C仓库 仓库编码:{} 组织机构主键:{} 公司名称:{}", facilityCode, bdCalbodyEntities.get(0).getPkCalbody(), bdCorpEntityList.get(0).getUnitname());
|
||||
|
@ -1662,7 +1669,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
|
||||
bdCubasdocEntity.setDataSourceCode("lets_u8c");
|
||||
bdCubasdocEntity.setDr(0L);
|
||||
bdCubasdocEntity.setDef1(memberId);
|
||||
bdCubasdocEntity.setDef1(memberId.trim());
|
||||
List<BdCubasdocEntity> bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
|
||||
if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据OFS会员id{},无法查询到U8C客商基本档案", memberId);
|
||||
|
@ -1688,11 +1695,12 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
// String platformZdyId = "0001A210000000000JUD";
|
||||
String platformZdyId = OverallConstant.getOverAllValue("u8c自定义项档案-平台主键");
|
||||
String sourcePlatformCode = header.getSourcePlatformCode();
|
||||
Assert.notNull(sourcePlatformCode, "sourcePlatformCode不能为空");
|
||||
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
|
||||
bdDefdocEntity.setPkDefdoclist(platformZdyId);
|
||||
bdDefdocEntity.setDr(0);
|
||||
bdDefdocEntity.setDataSourceCode("lets_u8c");
|
||||
bdDefdocEntity.setDoccode(sourcePlatformCode);
|
||||
bdDefdocEntity.setDoccode(sourcePlatformCode.trim());
|
||||
List<BdDefdocEntity> bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
|
||||
if (bdDefdocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O平台编码{},无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId);
|
||||
|
@ -1704,11 +1712,12 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
// String platformZdyId2 = "0001A210000000000XZX";
|
||||
String platformZdyId2 = OverallConstant.getOverAllValue("u8c自定义项档案-店铺主键");
|
||||
String ofsStoreCode = header.getStoreCode();
|
||||
Assert.notNull(ofsStoreCode, "ofsStoreCode不能为空");
|
||||
BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity();
|
||||
bdDefdocEntity2.setPkDefdoclist(platformZdyId2);
|
||||
bdDefdocEntity2.setDr(0);
|
||||
bdDefdocEntity2.setDataSourceCode("lets_u8c");
|
||||
bdDefdocEntity2.setDoccode(ofsStoreCode);
|
||||
bdDefdocEntity2.setDoccode(ofsStoreCode.trim());
|
||||
List<BdDefdocEntity> bdDefdocEntityList2 = iBdDefdocDao.query(bdDefdocEntity2);
|
||||
if (bdDefdocEntityList2.size() == 0) {
|
||||
Assert.state(false, "根据O店铺编码{},无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId);
|
||||
|
|
|
@ -1075,7 +1075,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
//测试
|
||||
// companyCode = "SHLZ";
|
||||
Assert.notNull(companyCode, "O出库单表头货主不能为空!");
|
||||
BdCorpEntity bdCorpEntity = cacheTocMapVo.getStringBdCorpEntityMap().get(companyCode);
|
||||
BdCorpEntity bdCorpEntity = cacheTocMapVo.getStringBdCorpEntityMap().get(companyCode.trim());
|
||||
Assert.notNull(bdCorpEntity, "根据公司编码({})没有匹配到U8C公司档案(公司编码=O货主)", companyCode);
|
||||
|
||||
//发货库存组织
|
||||
|
@ -1088,7 +1088,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
//2024年8月5日 15:06:38 仓库O与U两边仓库编码是一致的,和妮姐确认过了
|
||||
String facilityCode = header.getFacilityCode();
|
||||
Assert.notNull(facilityCode, "O仓库编码不能为空");
|
||||
BdStordocEntity bdStordocEntity = cacheTocMapVo.getStringBdStordocEntityMap().get(facilityCode + bdCalbodyEntity.getPkCalbody());
|
||||
BdStordocEntity bdStordocEntity = cacheTocMapVo.getStringBdStordocEntityMap().get(facilityCode.trim() + bdCalbodyEntity.getPkCalbody());
|
||||
Assert.notNull(bdStordocEntity, "没有匹配到发货仓库 O库存地点编码:{} 发货库存组织主键:{}", facilityCode, bdCalbodyEntity.getPkCalbody());
|
||||
|
||||
//2024年8月5日 15:25:07 收货库存组织、收货仓库、默认和发货库存组织、发货仓库一致,已经和佳妮确认
|
||||
|
@ -1132,12 +1132,14 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
Assert.notNull(bdCumandocEntity, "无法匹配到客商管理档案 店铺编码:{}", storeCode);
|
||||
|
||||
//查找平台
|
||||
BdDefdocEntity bdDefdocEntity = cacheTocMapVo.getStringBdDefdocPlatformEntityMap().get(header.getSourcePlatformCode());
|
||||
Assert.notNull(bdDefdocEntity, "根据O平台编码({})无法匹配到U8C平台自定义档案", header.getSourcePlatformCode());
|
||||
Assert.notNull(header.getSourcePlatformCode(), "sourcePlatformCode不能为空");
|
||||
BdDefdocEntity bdDefdocEntity = cacheTocMapVo.getStringBdDefdocPlatformEntityMap().get(header.getSourcePlatformCode().trim());
|
||||
Assert.notNull(bdDefdocEntity, "根据O平台编码({})无法匹配到U8C平台自定义档案", header.getSourcePlatformCode().trim());
|
||||
|
||||
//查找店铺
|
||||
BdDefdocEntity bdDefdocEntity1 = cacheTocMapVo.getStringBdDefdocShopEntityMap().get(header.getStoreCode());
|
||||
Assert.notNull(bdDefdocEntity1, "根据O店铺编码({})无法匹配到U8C店铺自定义档案", header.getStoreCode());
|
||||
Assert.notNull(header.getStoreCode(), "sourcePlatformCode不能为空");
|
||||
BdDefdocEntity bdDefdocEntity1 = cacheTocMapVo.getStringBdDefdocShopEntityMap().get(header.getStoreCode().trim());
|
||||
Assert.notNull(bdDefdocEntity1, "根据O店铺编码({})无法匹配到U8C店铺自定义档案", header.getStoreCode().trim());
|
||||
|
||||
//字段拷贝
|
||||
for (int j = 0; j < details.size(); j++) {
|
||||
|
@ -1171,14 +1173,15 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
}
|
||||
|
||||
//存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity = cacheTocMapVo.getStringBdInvbasdocEntityMap().get(detailsDto.getSkuCode());
|
||||
Assert.notNull(bdInvbasdocEntity, "无法匹配到存货基本档案 存货编码:{} 公司:{}", detailsDto.getSkuCode(), bdCorpEntity.getPkCorp());
|
||||
Assert.notNull(detailsDto.getSkuCode(), "skucode不能为空");
|
||||
BdInvbasdocEntity bdInvbasdocEntity = cacheTocMapVo.getStringBdInvbasdocEntityMap().get(detailsDto.getSkuCode().trim());
|
||||
Assert.notNull(bdInvbasdocEntity, "无法匹配到存货基本档案 存货编码:{} 公司:{}", detailsDto.getSkuCode().trim(), bdCorpEntity.getPkCorp().trim());
|
||||
//存货管理档案,是发货公司的存货档案
|
||||
BdInvmandocEntity bdInvmandocEntity = cacheTocMapVo.getStringBdInvmandocEntityMap().get(detailsDto.getSkuCode() + bdCorpEntity.getPkCorp());
|
||||
Assert.notNull(bdInvmandocEntity, "无法匹配到存货管理档案 货品sku:{} 公司:{}", detailsDto.getSkuCode(), bdCorpEntity.getPkCorp());
|
||||
BdInvmandocEntity bdInvmandocEntity = cacheTocMapVo.getStringBdInvmandocEntityMap().get(detailsDto.getSkuCode().trim() + bdCorpEntity.getPkCorp().trim());
|
||||
Assert.notNull(bdInvmandocEntity, "无法匹配到存货管理档案 货品sku:{} 公司:{}", detailsDto.getSkuCode().trim(), bdCorpEntity.getPkCorp().trim());
|
||||
//存货税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = cacheTocMapVo.getStringBdTaxitemsEntityMap().get(bdInvmandocEntity.getInvcode());
|
||||
Assert.notNull(bdTaxitemsEntity, "无法匹配到存货税率 存货编码:{}", bdInvmandocEntity.getInvcode());
|
||||
BdTaxitemsEntity bdTaxitemsEntity = cacheTocMapVo.getStringBdTaxitemsEntityMap().get(bdInvmandocEntity.getInvcode().trim());
|
||||
Assert.notNull(bdTaxitemsEntity, "无法匹配到存货税率 存货编码:{}", bdInvmandocEntity.getInvcode().trim());
|
||||
|
||||
//2024年8月6日 10:16:22 通过O出库单的表头,查询得出U8C档案,放在表体的原因是方便分组汇总
|
||||
//下一个步骤的分组汇总,是通过表体明细完成的
|
||||
|
|
|
@ -559,7 +559,10 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
|
||||
Assert.notNull(stockinB.getId(), "O明细主键不能为空!");
|
||||
Assert.state(!"".equals(stockinB.getId()), "O明细主键不能为空!");
|
||||
|
||||
idStr.append("'");
|
||||
idStr.append(stockinB.getId());
|
||||
idStr.append("'");
|
||||
idStr.append(",");
|
||||
}
|
||||
}
|
||||
|
@ -919,13 +922,15 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
|
||||
try {
|
||||
//查询OFS售后订单
|
||||
RerturnGoodsOrderSearchData ofsRertunOrder = afterSalesOrderUtil.getOfsRertunOrder(header.getRefOrderCode());
|
||||
Assert.notNull(header.getRefOrderCode(), "header.getRefOrderCode()不能为空!");
|
||||
RerturnGoodsOrderSearchData ofsRertunOrder = afterSalesOrderUtil.getOfsRertunOrder(header.getRefOrderCode().trim());
|
||||
Assert.notNull(ofsRertunOrder, "无法查询到OFS售后订单 编码:{}", header.getRefOrderCode());
|
||||
|
||||
//查询OFS销售订单
|
||||
SaleOrderMessageDto saleOrderMessageDto = null;
|
||||
try {
|
||||
saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder(ofsRertunOrder.getHeader().getRefOrderCode());
|
||||
Assert.notNull(ofsRertunOrder.getHeader().getRefOrderCode(), "ofsRertunOrder.getHeader().getRefOrderCode()不能为空!");
|
||||
saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder(ofsRertunOrder.getHeader().getRefOrderCode().trim());
|
||||
} catch (Exception e) {
|
||||
logger.error("查询出售后订单错误,失败原因:{}", e.getMessage());
|
||||
Assert.state(false, "查询出售后订单错误,失败原因:{}", e.getMessage());
|
||||
|
@ -952,7 +957,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
if (header1.getSubOrderType() == null || "".equals(header1.getSubOrderType().trim())) {
|
||||
header1.setSubOrderType("SALES");
|
||||
}
|
||||
BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject(header1.getSubOrderType());
|
||||
BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject(header1.getSubOrderType().trim());
|
||||
Assert.notNull(bdRdclEntity, "根据收发类别编码:{} 无法匹配到U8C收发类别");
|
||||
|
||||
// 销售公司、发货公司
|
||||
|
@ -963,7 +968,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
BdCorpEntity bdCorpEntity = new BdCorpEntity();
|
||||
bdCorpEntity.setDr(0);
|
||||
bdCorpEntity.setDataSourceCode("lets_u8c");
|
||||
bdCorpEntity.setUnitcode(companyCode);
|
||||
bdCorpEntity.setUnitcode(companyCode.trim());
|
||||
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
|
||||
if (bdCorpEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O货主编码{},无法匹配到U8C销售公司", companyCode);
|
||||
|
@ -990,7 +995,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
bdStordocEntity.setDr(0L);
|
||||
bdStordocEntity.setDataSourceCode("lets_u8c");
|
||||
bdStordocEntity.setPkCalbody(bdCalbodyEntities.get(0).getPkCalbody());
|
||||
bdStordocEntity.setStorcode(facilityCode);
|
||||
bdStordocEntity.setStorcode(facilityCode.trim());
|
||||
List<BdStordocEntity> bdStordocEntityList = iBdStordocDao.query(bdStordocEntity);
|
||||
if (bdStordocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O仓库编码+U8C发货库存组织主键,无法匹配到U8C仓库", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
|
||||
|
@ -1031,10 +1036,11 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
} else {
|
||||
logger.info("OFS销售订单号:{} 存在部门字段:{}!", header2.getCode(), header2.getDepartmentType());
|
||||
String departmentType = header2.getDepartmentType();
|
||||
Assert.notNull(departmentType, "departmentType不能为空!");
|
||||
BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity();
|
||||
bdDeptdocEntity.setDataSourceCode("lets_u8c");
|
||||
bdDeptdocEntity.setDr(0);
|
||||
bdDeptdocEntity.setDeptcode(departmentType);
|
||||
bdDeptdocEntity.setDeptcode(departmentType.trim());
|
||||
bdDeptdocEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
|
||||
bdDeptdocEntityList = iBdDeptdocDao.query(bdDeptdocEntity);
|
||||
if (bdDeptdocEntityList.size() == 0) {
|
||||
|
@ -1049,7 +1055,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
|
||||
bdCubasdocEntity.setDataSourceCode("lets_u8c");
|
||||
bdCubasdocEntity.setDr(0L);
|
||||
bdCubasdocEntity.setDef1(memberId);
|
||||
bdCubasdocEntity.setDef1(memberId.trim());
|
||||
List<BdCubasdocEntity> bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
|
||||
if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据OFS会员id{},无法查询到U8C客商基本档案", memberId);
|
||||
|
@ -1073,11 +1079,12 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
// String platformZdyId = "0001A210000000000JUD";
|
||||
String platformZdyId = OverallConstant.getOverAllValue("u8c自定义项档案-平台主键");
|
||||
String sourcePlatformCode = header.getSourcePlatformCode();
|
||||
Assert.notNull(sourcePlatformCode, "sourcePlatformCode不能为空");
|
||||
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
|
||||
bdDefdocEntity.setPkDefdoclist(platformZdyId);
|
||||
bdDefdocEntity.setDr(0);
|
||||
bdDefdocEntity.setDataSourceCode("lets_u8c");
|
||||
bdDefdocEntity.setDoccode(sourcePlatformCode);
|
||||
bdDefdocEntity.setDoccode(sourcePlatformCode.trim());
|
||||
List<BdDefdocEntity> bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
|
||||
if (bdDefdocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O平台编码{},无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId);
|
||||
|
@ -1089,11 +1096,12 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
// String platformZdyId2 = "0001A210000000000XZX";
|
||||
String platformZdyId2 = OverallConstant.getOverAllValue("u8c自定义项档案-店铺主键");
|
||||
String ofsStoreCode = header.getStoreCode();
|
||||
Assert.notNull(ofsStoreCode, "ofsStoreCode不能为空");
|
||||
BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity();
|
||||
bdDefdocEntity2.setPkDefdoclist(platformZdyId2);
|
||||
bdDefdocEntity2.setDr(0);
|
||||
bdDefdocEntity2.setDataSourceCode("lets_u8c");
|
||||
bdDefdocEntity2.setDoccode(ofsStoreCode);
|
||||
bdDefdocEntity2.setDoccode(ofsStoreCode.trim());
|
||||
List<BdDefdocEntity> bdDefdocEntityList2 = iBdDefdocDao.query(bdDefdocEntity2);
|
||||
if (bdDefdocEntityList2.size() == 0) {
|
||||
Assert.state(false, "根据O店铺编码{},无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId);
|
||||
|
@ -1168,13 +1176,16 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
|
||||
try {
|
||||
//查询OFS售后订单
|
||||
RerturnGoodsOrderSearchData ofsRertunOrder = afterSalesOrderUtil.getOfsRertunOrder(header.getRefOrderCode());
|
||||
Assert.notNull(header.getRefOrderCode(), "header.getRefOrderCode()不能为空!");
|
||||
RerturnGoodsOrderSearchData ofsRertunOrder = afterSalesOrderUtil.getOfsRertunOrder(header.getRefOrderCode().trim());
|
||||
Assert.notNull(ofsRertunOrder, "无法查询到OFS售后订单 编码:{}", header.getRefOrderCode());
|
||||
|
||||
//查询OFS销售订单
|
||||
SaleOrderMessageDto saleOrderMessageDto = null;
|
||||
try {
|
||||
saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder(ofsRertunOrder.getHeader().getRefOrderCode());
|
||||
Assert.notNull(ofsRertunOrder.getHeader(), "ofsRertunOrder.getHeader()不能为空");
|
||||
Assert.notNull(ofsRertunOrder.getHeader().getRefOrderCode(), "ofsRertunOrder.getHeader().getRefOrderCode()不能为空");
|
||||
saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder(ofsRertunOrder.getHeader().getRefOrderCode().trim());
|
||||
} catch (Exception e) {
|
||||
logger.error("查询出售后订单错误,失败原因:{}", e.getMessage());
|
||||
Assert.state(false, "查询出售后订单错误,失败原因:{}", e.getMessage());
|
||||
|
@ -1201,15 +1212,17 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
if (header1.getSubOrderType() == null || "".equals(header1.getSubOrderType().trim())) {
|
||||
header1.setSubOrderType("SALES");
|
||||
}
|
||||
BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject(header1.getSubOrderType());
|
||||
BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject(header1.getSubOrderType().trim());
|
||||
Assert.notNull(bdRdclEntity, "根据收发类别编码:{} 无法匹配到U8C收发类别");
|
||||
|
||||
//2024年8月30日 10:57:29 查询对应的U8C销售订单,注意要把编码和主键一起查询,O主键导入到U8C中,对于U8C来说可能会重复
|
||||
Assert.notNull(header.getCode(), "header.getCode()不能为空");
|
||||
Assert.notNull(header.getId(), "header.getId()不能为空");
|
||||
SoSaleEntity soSaleEntity = new SoSaleEntity();
|
||||
soSaleEntity.setDr(0L);
|
||||
soSaleEntity.setDataSourceCode("lets_u8c");
|
||||
soSaleEntity.setVdef19(header.getCode());
|
||||
soSaleEntity.setVdef20(header.getId());
|
||||
soSaleEntity.setVdef19(header.getCode().trim());
|
||||
soSaleEntity.setVdef20(header.getId().trim());
|
||||
soSaleEntity.setBretinvflag("Y");//仅查询红字销售订单
|
||||
List<SoSaleEntity> soSaleEntityList = iSoSaleDao.query(soSaleEntity);
|
||||
if (soSaleEntityList == null || soSaleEntityList.size() == 0) {
|
||||
|
@ -1268,7 +1281,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
BdCorpEntity bdCorpEntity = new BdCorpEntity();
|
||||
bdCorpEntity.setDr(0);
|
||||
bdCorpEntity.setDataSourceCode("lets_u8c");
|
||||
bdCorpEntity.setUnitcode(companyCode);
|
||||
bdCorpEntity.setUnitcode(companyCode.trim());
|
||||
List<BdCorpEntity> bdCorpEntityList = iBdCorpDao.query(bdCorpEntity);
|
||||
if (bdCorpEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O货主编码{},无法匹配到U8C销售公司", companyCode);
|
||||
|
@ -1295,7 +1308,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
bdStordocEntity.setDr(0L);
|
||||
bdStordocEntity.setDataSourceCode("lets_u8c");
|
||||
bdStordocEntity.setPkCalbody(bdCalbodyEntities.get(0).getPkCalbody());
|
||||
bdStordocEntity.setStorcode(facilityCode);
|
||||
bdStordocEntity.setStorcode(facilityCode.trim());
|
||||
List<BdStordocEntity> bdStordocEntityList = iBdStordocDao.query(bdStordocEntity);
|
||||
if (bdStordocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O仓库编码+U8C发货库存组织主键,无法匹配到U8C仓库", facilityCode, bdCalbodyEntities.get(0).getPkCalbody());
|
||||
|
@ -1339,7 +1352,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity();
|
||||
bdDeptdocEntity.setDataSourceCode("lets_u8c");
|
||||
bdDeptdocEntity.setDr(0);
|
||||
bdDeptdocEntity.setDeptcode(departmentType);
|
||||
bdDeptdocEntity.setDeptcode(departmentType.trim());
|
||||
bdDeptdocEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp());
|
||||
bdDeptdocEntityList = iBdDeptdocDao.query(bdDeptdocEntity);
|
||||
if (bdDeptdocEntityList.size() == 0) {
|
||||
|
@ -1353,7 +1366,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity();
|
||||
bdCubasdocEntity.setDataSourceCode("lets_u8c");
|
||||
bdCubasdocEntity.setDr(0L);
|
||||
bdCubasdocEntity.setDef1(memberId);
|
||||
bdCubasdocEntity.setDef1(memberId.trim());
|
||||
List<BdCubasdocEntity> bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity);
|
||||
if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据OFS会员id{},无法查询到U8C客商基本档案", memberId);
|
||||
|
@ -1377,11 +1390,12 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
// String platformZdyId = "0001A210000000000JUD";
|
||||
String platformZdyId = OverallConstant.getOverAllValue("u8c自定义项档案-平台主键");
|
||||
String sourcePlatformCode = header.getSourcePlatformCode();
|
||||
Assert.notNull(sourcePlatformCode, "sourcePlatformCode不能为空!");
|
||||
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
|
||||
bdDefdocEntity.setPkDefdoclist(platformZdyId);
|
||||
bdDefdocEntity.setDr(0);
|
||||
bdDefdocEntity.setDataSourceCode("lets_u8c");
|
||||
bdDefdocEntity.setDoccode(sourcePlatformCode);
|
||||
bdDefdocEntity.setDoccode(sourcePlatformCode.trim());
|
||||
List<BdDefdocEntity> bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
|
||||
if (bdDefdocEntityList.size() == 0) {
|
||||
Assert.state(false, "根据O平台编码{},无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId);
|
||||
|
@ -1393,11 +1407,12 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
// String platformZdyId2 = "0001A210000000000XZX";
|
||||
String platformZdyId2 = OverallConstant.getOverAllValue("u8c自定义项档案-店铺主键");
|
||||
String ofsStoreCode = header.getStoreCode();
|
||||
Assert.notNull(ofsStoreCode, "ofsStoreCode不能为空");
|
||||
BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity();
|
||||
bdDefdocEntity2.setPkDefdoclist(platformZdyId2);
|
||||
bdDefdocEntity2.setDr(0);
|
||||
bdDefdocEntity2.setDataSourceCode("lets_u8c");
|
||||
bdDefdocEntity2.setDoccode(ofsStoreCode);
|
||||
bdDefdocEntity2.setDoccode(ofsStoreCode.trim());
|
||||
List<BdDefdocEntity> bdDefdocEntityList2 = iBdDefdocDao.query(bdDefdocEntity2);
|
||||
if (bdDefdocEntityList2.size() == 0) {
|
||||
Assert.state(false, "根据O店铺编码{},无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId);
|
||||
|
|
|
@ -1093,26 +1093,27 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
try {
|
||||
//OFS售后订单
|
||||
RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData1 = header.getRerturnGoodsOrderSearchData();
|
||||
Assert.notNull(rerturnGoodsOrderSearchData1, "无法关联到OFS售后订单 售后入库单号:{}", header.getCode());
|
||||
Assert.notNull(header.getCode(), "OFS售后订单对应的code不能为空");
|
||||
Assert.notNull(rerturnGoodsOrderSearchData1, "无法关联到OFS售后订单 售后入库单号:{}", header.getCode().trim());
|
||||
//OFS销售订单
|
||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = header.getHeaderDetailsDto();
|
||||
com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto header1 = headerDetailsDto.getHeader();
|
||||
List<DetailsDto> details1 = headerDetailsDto.getDetails();
|
||||
Assert.notNull(headerDetailsDto, "无法关联到OFS销售订单 售后入库单号:{}", header.getCode());
|
||||
Assert.notNull(headerDetailsDto, "无法关联到OFS销售订单 售后入库单号:{}", header.getCode().trim());
|
||||
|
||||
//如果不存在,则默认一个
|
||||
if (header1.getSubOrderType() == null || "".equals(header1.getSubOrderType())) {
|
||||
header1.setSubOrderType("SALES");
|
||||
}
|
||||
BdRdclEntity bdRdclEntity = cacheTocMapVoV2.getStringBdRdclEntityMap().get(header1.getSubOrderType());
|
||||
Assert.notNull(bdRdclEntity, "根据业务类型({})没有匹配到U8C业务类型", header1.getSubOrderType());
|
||||
BdRdclEntity bdRdclEntity = cacheTocMapVoV2.getStringBdRdclEntityMap().get(header1.getSubOrderType().trim());
|
||||
Assert.notNull(bdRdclEntity, "根据业务类型({})没有匹配到U8C业务类型", header1.getSubOrderType().trim());
|
||||
|
||||
//表头公司:通过名称匹配U8C公司
|
||||
// String corpName = "上海丽知品牌管理有限公司";
|
||||
//测试SHOF
|
||||
// header.setCompanyCode("SHOF");
|
||||
Assert.notNull(header.getCompanyCode(), "O货主编码不能为空");
|
||||
BdCorpEntity bdCorpEntity = cacheTocMapVoV2.getStringBdCorpEntityMap().get(header.getCompanyCode());
|
||||
BdCorpEntity bdCorpEntity = cacheTocMapVoV2.getStringBdCorpEntityMap().get(header.getCompanyCode().trim());
|
||||
Assert.notNull(bdCorpEntity, "根据O公司编码(货主编码)({})没有匹配到U8C公司档案", header.getCompanyCode());
|
||||
|
||||
//发货库存组织
|
||||
|
@ -1125,7 +1126,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
//2024年8月5日 15:06:38 仓库O与U两边仓库编码是一致的,和妮姐确认过了
|
||||
String facilityCode = header.getFacilityCode();
|
||||
Assert.notNull(facilityCode, "O仓库编码不能为空");
|
||||
BdStordocEntity bdStordocEntity = cacheTocMapVoV2.getStringBdStordocEntityMap().get(facilityCode + bdCalbodyEntity.getPkCalbody());
|
||||
BdStordocEntity bdStordocEntity = cacheTocMapVoV2.getStringBdStordocEntityMap().get(facilityCode.trim() + bdCalbodyEntity.getPkCalbody());
|
||||
Assert.notNull(bdStordocEntity, "没有匹配到发货仓库 O库存地点编码:{} 发货库存组织主键:{} ", facilityCode, bdCalbodyEntity.getPkCalbody());
|
||||
|
||||
//2024年8月5日 15:25:07 收货库存组织、收货仓库、默认和发货库存组织、发货仓库一致,已经和佳妮确认
|
||||
|
@ -1155,7 +1156,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
String storeCode = header.getStoreCode();
|
||||
Assert.notNull(storeCode, "O店铺编码不能为空,没有办法完成业务逻辑!");
|
||||
Assert.state(!"".equals(storeCode.trim()), "O店铺编码不能为空,没有办法完成业务逻辑!");
|
||||
BdCubasdocEntity bdCubasdocEntity = cacheTocMapVoV2.getStringBdCubasdocEntityMap().get(storeCode);
|
||||
BdCubasdocEntity bdCubasdocEntity = cacheTocMapVoV2.getStringBdCubasdocEntityMap().get(storeCode.trim());
|
||||
Assert.notNull(bdCubasdocEntity, "无法匹配到客户档案 客商名称:{}", storeCode);
|
||||
|
||||
//客商管理档案:2024年8月5日 15:41:54 TOC店铺名称查询U8C客商档案,已经和妮姐确认
|
||||
|
@ -1167,13 +1168,13 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
//查找平台
|
||||
String sourcePlatformCode = header.getSourcePlatformCode();
|
||||
Assert.notNull(sourcePlatformCode, "O平台编码不能为空!");
|
||||
BdDefdocEntity bdDefdocEntity = cacheTocMapVoV2.getStringBdDefdocEntityMap().get(sourcePlatformCode);
|
||||
BdDefdocEntity bdDefdocEntity = cacheTocMapVoV2.getStringBdDefdocEntityMap().get(sourcePlatformCode.trim());
|
||||
Assert.notNull(bdDefdocEntity, "根据O平台编码({})无法匹配到U8C平台档案", header.getSourcePlatformCode());
|
||||
|
||||
//查找店铺
|
||||
// String storeCode2 = header.getStoreCode();
|
||||
// Assert.notNull(storeCode2, "O店铺编码不能为空!");
|
||||
BdDefdocEntity bdDefdocEntity1 = cacheTocMapVoV2.getStringBdDefdocEntityMap1().get(storeCode);
|
||||
BdDefdocEntity bdDefdocEntity1 = cacheTocMapVoV2.getStringBdDefdocEntityMap1().get(storeCode.trim());
|
||||
Assert.notNull(bdDefdocEntity1, "根据O店铺编码({})无法匹配到U8C店铺档案", storeCode);
|
||||
|
||||
//字段拷贝
|
||||
|
@ -1181,11 +1182,12 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j);
|
||||
|
||||
//存货管理档案,是发货公司的存货档案
|
||||
BdInvmandocEntity bdInvmandocEntity = cacheTocMapVoV2.getStringBdInvmandocEntityMap().get(stockinB.getSkuCode() + bdCorpEntity.getPkCorp());
|
||||
Assert.notNull(bdInvmandocEntity, "无法匹配到存货管理档案 货品sku:{} 公司:{}", stockinB.getSkuCode(), bdCorpEntity.getPkCorp());
|
||||
Assert.notNull(stockinB.getSkuCode(), "skucode不能为空");
|
||||
BdInvmandocEntity bdInvmandocEntity = cacheTocMapVoV2.getStringBdInvmandocEntityMap().get(stockinB.getSkuCode().trim() + bdCorpEntity.getPkCorp());
|
||||
Assert.notNull(bdInvmandocEntity, "无法匹配到存货管理档案 货品sku:{} 公司:{}", stockinB.getSkuCode().trim(), bdCorpEntity.getPkCorp());
|
||||
//存货基本档案
|
||||
BdInvbasdocEntity bdInvbasdocEntity = cacheTocMapVoV2.getStringBdInvbasdocEntityMap().get(stockinB.getSkuCode());
|
||||
Assert.notNull(bdInvbasdocEntity, "无法匹配到存货基本档案 存货编码:{}", stockinB.getSkuCode());
|
||||
BdInvbasdocEntity bdInvbasdocEntity = cacheTocMapVoV2.getStringBdInvbasdocEntityMap().get(stockinB.getSkuCode().trim());
|
||||
Assert.notNull(bdInvbasdocEntity, "无法匹配到存货基本档案 存货编码:{}", stockinB.getSkuCode().trim());
|
||||
//存货税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity = cacheTocMapVoV2.getStringBdTaxitemsEntityMap().get(bdInvmandocEntity.getInvcode());
|
||||
Assert.notNull(bdTaxitemsEntity, "无法匹配到存货税率 存货编码:{}", bdInvmandocEntity.getInvcode());
|
||||
|
|
|
@ -96,9 +96,9 @@ class SoSaleOutPluginInitializerToCTest {
|
|||
// soSaleOutPluginInitializerToC.startImplementStockByCode(s, "stock");
|
||||
|
||||
try {
|
||||
soSaleOutPluginInitializerToC.startImplementStockByTime("2024-10-18 00:00:00", "2024-10-18 23:59:59");
|
||||
// String code = "LETS-SH2024101600027243";
|
||||
// soSaleOutPluginInitializerToC.startImplementStockByCode(code, "stock");
|
||||
// soSaleOutPluginInitializerToC.startImplementStockByTime("2024-10-18 00:00:00", "2024-10-18 23:59:59");
|
||||
String code = "LETS-SH2024101700027117";
|
||||
soSaleOutPluginInitializerToC.startImplementStockByCode(code, "stock");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue