refactor(sales): 重构公司档案对照逻辑

- 注释掉 OfsPassiveorderDetailEntity.xml 中的排序逻辑
- 移除 PassiveWarehouseReceiptToC、SoSaleOutPluginInitializerToC 和 SoSaleReturnPluginInitializerToC 中的公司档案对照代码
- 注释掉 QueryU8CEntityUtil 中的 queryBdDefDocByPkDefDocList 方法
- 修改 PassiveWarehouseReceiptToC 中的退款时间设置逻辑,增加空值判断
This commit is contained in:
liuy 2025-03-13 17:18:46 +08:00
parent 3c5c54a5f7
commit 7b9083b699
6 changed files with 46 additions and 43 deletions

View File

@ -85,8 +85,8 @@
<if test="newsystemprimary2 != null and newsystemprimary2 != ''"> and newsystemprimary2 = #{newsystemprimary2} </if> <if test="newsystemprimary2 != null and newsystemprimary2 != ''"> and newsystemprimary2 = #{newsystemprimary2} </if>
<if test="ids!=null and ids!=''">and id in (${ids})</if> <if test="ids!=null and ids!=''">and id in (${ids})</if>
</trim> </trim>
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if> <!-- <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>-->
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if> <!-- <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>-->
</select> </select>
<!-- 查询符合条件的数量 --> <!-- 查询符合条件的数量 -->

View File

@ -479,9 +479,9 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
Assert.notNull(details1.getId(), "O明细主键不能为空"); Assert.notNull(details1.getId(), "O明细主键不能为空");
Assert.state(!"".equals(details1.getId()), "O明细主键不能为空"); Assert.state(!"".equals(details1.getId()), "O明细主键不能为空");
idStr.append("'"); // idStr.append("'");
idStr.append(details1.getId()); idStr.append(details1.getId());
idStr.append("'"); // idStr.append("'");
idStr.append(","); idStr.append(",");
} }
} }
@ -1238,7 +1238,7 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
CacheTocMapVoV2 cacheTocMapVoV2 = passiveComponentsArchivesCacheUtil.initCache(passiveStorageResponseDataList); CacheTocMapVoV2 cacheTocMapVoV2 = passiveComponentsArchivesCacheUtil.initCache(passiveStorageResponseDataList);
//初始化公司档案对照关系 //初始化公司档案对照关系
Map<String, String> comparisonCompanyArchives = queryU8CEntityUtil.queryBdDefDocByPkDefDocAll(); // Map<String, String> comparisonCompanyArchives = queryU8CEntityUtil.queryBdDefDocByPkDefDocAll();
for (int i = 0; i < passiveStorageResponseDataList.size(); i++) { for (int i = 0; i < passiveStorageResponseDataList.size(); i++) {
PassiveStorageResponse.Data data = passiveStorageResponseDataList.get(i); PassiveStorageResponse.Data data = passiveStorageResponseDataList.get(i);
@ -1271,10 +1271,10 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
String companyCode = header.getCompanyCode(); String companyCode = header.getCompanyCode();
Assert.notNull(companyCode, "O货主编码不能为空"); Assert.notNull(companyCode, "O货主编码不能为空");
//查找是否替换公司 //查找是否替换公司
String targetCorp = comparisonCompanyArchives.get(companyCode); // String targetCorp = comparisonCompanyArchives.get(companyCode);
if (targetCorp != null) { // if (targetCorp != null) {
companyCode = targetCorp; // companyCode = targetCorp;
} // }
BdCorpEntity bdCorpEntity = cacheTocMapVoV2.getStringBdCorpEntityMap().get(companyCode.trim()); BdCorpEntity bdCorpEntity = cacheTocMapVoV2.getStringBdCorpEntityMap().get(companyCode.trim());
Assert.notNull(bdCorpEntity, "根据O公司编码(货主编码)({})没有匹配到U8C公司档案", header.getCompanyCode()); Assert.notNull(bdCorpEntity, "根据O公司编码(货主编码)({})没有匹配到U8C公司档案", header.getCompanyCode());
@ -1987,12 +1987,14 @@ public class PassiveWarehouseReceiptToC extends PluginBaseEntity {
List<RerturnGoodsOrderSearchDetails> details1 = rerturnGoodsOrderSearchData.getDetails(); List<RerturnGoodsOrderSearchDetails> details1 = rerturnGoodsOrderSearchData.getDetails();
String refundedAt = header1.getRefundedAt(); String refundedAt = header1.getRefundedAt();
if (refundedAt != null) {
for (PassiveStorageResponse.Details passiveStorage : details) { for (PassiveStorageResponse.Details passiveStorage : details) {
passiveStorage.setRefundedAt(refundedAt); passiveStorage.setRefundedAt(refundedAt);
} }
} }
} }
} }
}
//去死皮 //去死皮
for (PassiveStorageResponse.Data data : passiveStorageResponseList) { for (PassiveStorageResponse.Data data : passiveStorageResponseList) {

View File

@ -1445,7 +1445,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
//计算OFS销售订单邮费分摊 //计算OFS销售订单邮费分摊
ofsOrderSalePostageFeeAllocationUtil.batchTocSalesPostageFeeAllocation(headerDetailsDtos); ofsOrderSalePostageFeeAllocationUtil.batchTocSalesPostageFeeAllocation(headerDetailsDtos);
//初始化公司档案对照关系 //初始化公司档案对照关系
Map<String, String> comparisonCompanyArchives = queryU8CEntityUtil.queryBdDefDocByPkDefDocAll(); // Map<String, String> comparisonCompanyArchives = queryU8CEntityUtil.queryBdDefDocByPkDefDocAll();
for (int i = 0; i < headerDetailsDtoList.size(); i++) { for (int i = 0; i < headerDetailsDtoList.size(); i++) {
HeaderDetailsDto headerDetailsDto = headerDetailsDtoList.get(i); HeaderDetailsDto headerDetailsDto = headerDetailsDtoList.get(i);
@ -1473,10 +1473,10 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
Assert.notNull(companyCode, "O出库单表头货主不能为空"); Assert.notNull(companyCode, "O出库单表头货主不能为空");
//查找是否替换公司 //查找是否替换公司
String targetCorp = comparisonCompanyArchives.get(companyCode); // String targetCorp = comparisonCompanyArchives.get(companyCode);
if (targetCorp != null) { // if (targetCorp != null) {
companyCode = targetCorp; // companyCode = targetCorp;
} // }
BdCorpEntity bdCorpEntity = cacheTocMapVo.getStringBdCorpEntityMap().get(companyCode.trim()); BdCorpEntity bdCorpEntity = cacheTocMapVo.getStringBdCorpEntityMap().get(companyCode.trim());
Assert.notNull(bdCorpEntity, "根据公司编码({})没有匹配到U8C公司档案(公司编码=O货主)", companyCode); Assert.notNull(bdCorpEntity, "根据公司编码({})没有匹配到U8C公司档案(公司编码=O货主)", companyCode);

View File

@ -1387,7 +1387,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
//计算OFS销售订单优惠金额分摊到明细行 //计算OFS销售订单优惠金额分摊到明细行
// ofsOrderAfterSalesAmountAllocationUtil.batchTocSalesAmountAllocation(rerturnGoodsOrderSearchData); // ofsOrderAfterSalesAmountAllocationUtil.batchTocSalesAmountAllocation(rerturnGoodsOrderSearchData);
//初始化公司档案对照关系 //初始化公司档案对照关系
Map<String, String> comparisonCompanyArchives = queryU8CEntityUtil.queryBdDefDocByPkDefDocAll(); // Map<String, String> comparisonCompanyArchives = queryU8CEntityUtil.queryBdDefDocByPkDefDocAll();
//测试 //测试
// StockinOrderSearchResponse.StockinOrder stockinOrder1 = returnGoodHeaderDetailsDataDtoList1.get(0); // StockinOrderSearchResponse.StockinOrder stockinOrder1 = returnGoodHeaderDetailsDataDtoList1.get(0);
@ -1423,10 +1423,10 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
String companyCode = header.getCompanyCode(); String companyCode = header.getCompanyCode();
Assert.notNull(companyCode, "O货主编码不能为空"); Assert.notNull(companyCode, "O货主编码不能为空");
//查找是否替换公司 //查找是否替换公司
String targetCorp = comparisonCompanyArchives.get(companyCode); // String targetCorp = comparisonCompanyArchives.get(companyCode);
if (targetCorp != null) { // if (targetCorp != null) {
companyCode = targetCorp; // companyCode = targetCorp;
} // }
BdCorpEntity bdCorpEntity = cacheTocMapVoV2.getStringBdCorpEntityMap().get(companyCode.trim()); BdCorpEntity bdCorpEntity = cacheTocMapVoV2.getStringBdCorpEntityMap().get(companyCode.trim());
Assert.notNull(bdCorpEntity, "根据O公司编码(货主编码)({})没有匹配到U8C公司档案", header.getCompanyCode()); Assert.notNull(bdCorpEntity, "根据O公司编码(货主编码)({})没有匹配到U8C公司档案", header.getCompanyCode());

View File

@ -368,28 +368,29 @@ public class QueryU8CEntityUtil {
* @return corpCode 如果时需要转换的会自动转换如果不需要返回原始公司编码 * @return corpCode 如果时需要转换的会自动转换如果不需要返回原始公司编码
*/ */
public String queryBdDefDocByPkDefDocList(String corpCode) { public String queryBdDefDocByPkDefDocList(String corpCode) {
Assert.notNull(corpCode, "公司三对一,入参公司不能为空!!!");
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
bdDefdocEntity.setPkDefdoclist(OverallConstant.getOverAllValue("u8c自定义项档案-公司对照"));
// bdDefdocEntity.setDr(0);
bdDefdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
bdDefdocEntity.setDoccode(corpCode.trim());
List<BdDefdocEntity> bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
if (bdDefdocEntityList != null && bdDefdocEntityList.size() == 1) {
// Assert.state(false, "根据自定义档案列表编码GSDY主键[{}],未查询到自定义档案", OverallConstant.getOverAllValue("u8c自定义项档案-公司对照"));
BdDefdocEntity bdDefdocEntity1 = bdDefdocEntityList.get(0);
String memo = bdDefdocEntity1.getMemo();
if (memo != null && !"".equals(memo)) {
String[] split = memo.split(",");
if (split.length > 0) {
return split[0];
}
}
} else if (bdDefdocEntityList != null && bdDefdocEntityList.size() >= 2) {
Assert.state(false, "存在歧义的匹配关系 公司编码:{}存在{}行对照关系!", corpCode);
}
return corpCode; return corpCode;
// Assert.notNull(corpCode, "公司三对一,入参公司不能为空!!!");
//
// BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
// bdDefdocEntity.setPkDefdoclist(OverallConstant.getOverAllValue("u8c自定义项档案-公司对照"));
//// bdDefdocEntity.setDr(0);
// bdDefdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE);
// bdDefdocEntity.setDoccode(corpCode.trim());
// List<BdDefdocEntity> bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
// if (bdDefdocEntityList != null && bdDefdocEntityList.size() == 1) {
//// Assert.state(false, "根据自定义档案列表编码GSDY主键[{}],未查询到自定义档案", OverallConstant.getOverAllValue("u8c自定义项档案-公司对照"));
// BdDefdocEntity bdDefdocEntity1 = bdDefdocEntityList.get(0);
// String memo = bdDefdocEntity1.getMemo();
// if (memo != null && !"".equals(memo)) {
// String[] split = memo.split(",");
// if (split.length > 0) {
// return split[0];
// }
// }
// } else if (bdDefdocEntityList != null && bdDefdocEntityList.size() >= 2) {
// Assert.state(false, "存在歧义的匹配关系 公司编码:{}存在{}行对照关系!", corpCode);
// }
// return corpCode;
// List<String> corpCollect = bdDefdocEntityList.stream().map(BdDefdocEntity::getDoccode).collect(Collectors.toList()); // List<String> corpCollect = bdDefdocEntityList.stream().map(BdDefdocEntity::getDoccode).collect(Collectors.toList());
// if (corpCollect.contains(corpCode)) { // if (corpCollect.contains(corpCode)) {
// String memo = bdDefdocEntityList.get(0).getMemo(); // String memo = bdDefdocEntityList.get(0).getMemo();

View File

@ -27,7 +27,7 @@ public class PassiveWarehouseReceiptToCTest {
@Test @Test
public void startImplementStockByTime() { public void startImplementStockByTime() {
try { try {
// passiveWarehouseReceiptToC.startImplementStockByTime("2025-03-11 00:00:00", "2025-03-11 23:59:59"); passiveWarehouseReceiptToC.startImplementStockByTime("2025-03-11 22:27:02", "2025-03-11 22:27:02");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }