refactor(sales): 重构销售出库单相关代码
-优化了生成业务日期的逻辑,使用交易成功时间作为业务日期- 调整了主键和业务日期的生成逻辑 - 修改了日志输出内容,使用更准确的时间字段 - 注释掉了不必要的代码片段 - 更新了测试用例中的订单编号
This commit is contained in:
parent
7c7f15152d
commit
1ebadb2b57
|
@ -1352,6 +1352,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
||||||
* 2024年9月4日 14:46:28
|
* 2024年9月4日 14:46:28
|
||||||
* 生成业务日期,以交易成功时间作为业务日期
|
* 生成业务日期,以交易成功时间作为业务日期
|
||||||
*
|
*
|
||||||
|
* @param header 销售出库单表头
|
||||||
|
* @param sonDetailsDto 销售出库单明细行
|
||||||
* @author liuyang
|
* @author liuyang
|
||||||
*/
|
*/
|
||||||
private String createGenerateBusinessDateTran(com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto header, SonDetailsDto sonDetailsDto) {
|
private String createGenerateBusinessDateTran(com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto header, SonDetailsDto sonDetailsDto) {
|
||||||
|
@ -1365,6 +1367,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
||||||
if (sonDetailsDto != null && sonDetailsDto.getId() != null) {
|
if (sonDetailsDto != null && sonDetailsDto.getId() != null) {
|
||||||
detailedId = sonDetailsDto.getId();
|
detailedId = sonDetailsDto.getId();
|
||||||
}
|
}
|
||||||
|
//注意⚠️:取明细行的交易成功时间
|
||||||
if (sonDetailsDto != null && sonDetailsDto.getTradeSuccessAt() != null) {
|
if (sonDetailsDto != null && sonDetailsDto.getTradeSuccessAt() != null) {
|
||||||
//TOC以出库日期作为业务日期
|
//TOC以出库日期作为业务日期
|
||||||
String tradeSuccessAt = sonDetailsDto.getTradeSuccessAt();
|
String tradeSuccessAt = sonDetailsDto.getTradeSuccessAt();
|
||||||
|
@ -2121,6 +2124,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
||||||
*/
|
*/
|
||||||
private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity, DetailsDto detailsDto) {
|
private void createPrimaryKeyAndBusinessDateAndBusinessType(TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity, DetailsDto detailsDto) {
|
||||||
if (tocofsSaleoutDetailedEntity != null && detailsDto != null && detailsDto.getHeaderDto() != null) {
|
if (tocofsSaleoutDetailedEntity != null && detailsDto != null && detailsDto.getHeaderDto() != null) {
|
||||||
|
//销售出库单表头
|
||||||
HeaderDto headerDto = detailsDto.getHeaderDto();
|
HeaderDto headerDto = detailsDto.getHeaderDto();
|
||||||
|
|
||||||
if (headerDto.getId() != null) {
|
if (headerDto.getId() != null) {
|
||||||
|
@ -2129,9 +2133,9 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
||||||
if (headerDto.getShipAt() != null) {
|
if (headerDto.getShipAt() != null) {
|
||||||
tocofsSaleoutDetailedEntity.setBusinessdate(headerDto.getShipAt());//业务日期-出库时间
|
tocofsSaleoutDetailedEntity.setBusinessdate(headerDto.getShipAt());//业务日期-出库时间
|
||||||
}
|
}
|
||||||
if (headerDto.getTradeSuccessAt() != null) {
|
// if (headerDto.getTradeSuccessAt() != null) {
|
||||||
tocofsSaleoutDetailedEntity.setSuccessfultradedate(headerDto.getTradeSuccessAt());//业务日期-交易时间
|
// tocofsSaleoutDetailedEntity.setSuccessfultradedate(headerDto.getTradeSuccessAt());//业务日期-交易时间
|
||||||
}
|
// }
|
||||||
tocofsSaleoutDetailedEntity.setBusinesstype("TOC_ORDER");//业务类型
|
tocofsSaleoutDetailedEntity.setBusinesstype("TOC_ORDER");//业务类型
|
||||||
} else {
|
} else {
|
||||||
logger.info("createPrimaryKeyAndBusinessDateAndBusinessType方法存在false!");
|
logger.info("createPrimaryKeyAndBusinessDateAndBusinessType方法存在false!");
|
||||||
|
@ -2483,7 +2487,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
||||||
Assert.state(false, "无法判断的业务类型");
|
Assert.state(false, "无法判断的业务类型");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.info("交易成功-红 业务日期:{} 汇总维度:{} 已经推送成功,不需要重新推送", header.getTradeSuccessAt(), keyGroup);
|
logger.info("交易成功-红 业务日期:{} 汇总维度:{} 已经推送成功,不需要重新推送", oldValue.get(0).getTradeSuccessAt(), keyGroup);
|
||||||
}
|
}
|
||||||
isOneSuccess = true;
|
isOneSuccess = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -2763,7 +2767,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
logger.info("结束第二阶段:销售订单 ->(自动生成) 销售出库单 ->(自动生成) 销售发票");
|
logger.info("结束第二阶段:销售订单 ->(自动生成) 销售出库单 ->(自动生成) 销售发票");
|
||||||
} else {
|
} else {
|
||||||
logger.info("交易成功-蓝 业务日期:{} 汇总维度:{}", header.getTradeSuccessAt(), keyGroup);
|
logger.info("交易成功-蓝 业务日期:{} 汇总维度:{}", oldValue.get(0).getTradeSuccessAt(), keyGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -118,7 +118,7 @@ class SoSaleOutPluginInitializerToCTest {
|
||||||
// soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
|
// soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
|
||||||
|
|
||||||
// String aaa = "LETS-SH2024102800021196";
|
// String aaa = "LETS-SH2024102800021196";
|
||||||
soSaleOutPluginInitializerToC.startImplementTranByTime("2024-11-13 11:30:41", "2024-11-13 11:30:41", "0");
|
// soSaleOutPluginInitializerToC.startImplementTranByTime("2024-11-13 11:30:41", "2024-11-13 11:30:41", "0");
|
||||||
|
|
||||||
// soSaleOutPluginInitializerToC.startImplementStockByTime("2024-12-24 21:53:57", "2024-12-24 21:53:57", "2");
|
// soSaleOutPluginInitializerToC.startImplementStockByTime("2024-12-24 21:53:57", "2024-12-24 21:53:57", "2");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -129,7 +129,7 @@ class SoSaleOutPluginInitializerToCTest {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110200030366", "stock");
|
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110200030366", "stock");
|
||||||
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024121200024676", "tran");
|
soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2025010100023112", "tran");
|
||||||
|
|
||||||
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024111700013756", "tran");
|
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024111700013756", "tran");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class SoSaleReturnPluginInitializerToCTest {
|
||||||
try {
|
try {
|
||||||
// soSaleReturnPluginInitializerToC.startImplementByTradeTime("2024-12-23 23:05:34", "2024-12-23 23:05:34", "2");
|
// soSaleReturnPluginInitializerToC.startImplementByTradeTime("2024-12-23 23:05:34", "2024-12-23 23:05:34", "2");
|
||||||
|
|
||||||
soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2024122800000272", "stock");
|
soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2024122800000084", "stock");
|
||||||
|
|
||||||
// soSaleReturnPluginInitializerToC.startImplementStockByTime("2024-12-24 16:02:17", "2024-12-24 16:02:17", "0");
|
// soSaleReturnPluginInitializerToC.startImplementStockByTime("2024-12-24 16:02:17", "2024-12-24 16:02:17", "0");
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,10 @@ public class TocofsSaleoutDetailedDto {
|
||||||
//库存 结束
|
//库存 结束
|
||||||
|
|
||||||
//交易红 开始
|
//交易红 开始
|
||||||
|
// @ExcelProperty(value = "交易-O交易成功时间")
|
||||||
|
// private String successfulTradeDate;
|
||||||
@ExcelProperty(value = "交易-O交易成功时间")
|
@ExcelProperty(value = "交易-O交易成功时间")
|
||||||
private String successfulTradeDate;
|
private String tradeSuccessAt;
|
||||||
|
|
||||||
@ExcelProperty(value = "交易红-推送状态")
|
@ExcelProperty(value = "交易红-推送状态")
|
||||||
private String newstate2;
|
private String newstate2;
|
||||||
|
|
|
@ -440,6 +440,7 @@
|
||||||
<result property="newsystemprimary3" column="newSystemPrimary3" jdbcType="VARCHAR"/>
|
<result property="newsystemprimary3" column="newSystemPrimary3" jdbcType="VARCHAR"/>
|
||||||
<result property="businessDate" column="businessDate" jdbcType="VARCHAR"/>
|
<result property="businessDate" column="businessDate" jdbcType="VARCHAR"/>
|
||||||
<result property="successfulTradeDate" column="successfulTradeDate" jdbcType="VARCHAR"/>
|
<result property="successfulTradeDate" column="successfulTradeDate" jdbcType="VARCHAR"/>
|
||||||
|
<result property="tradeSuccessAt" column="tradeSuccessAt" jdbcType="VARCHAR"/>
|
||||||
|
|
||||||
<result property="def7" column="def7" jdbcType="VARCHAR"/>
|
<result property="def7" column="def7" jdbcType="VARCHAR"/>
|
||||||
<result property="def8" column="def8" jdbcType="VARCHAR"/>
|
<result property="def8" column="def8" jdbcType="VARCHAR"/>
|
||||||
|
@ -530,6 +531,7 @@
|
||||||
,a.businessDate
|
,a.businessDate
|
||||||
,a.successfulTradeDate
|
,a.successfulTradeDate
|
||||||
,a.businessType
|
,a.businessType
|
||||||
|
,a.tradeSuccessAt
|
||||||
,a.def1
|
,a.def1
|
||||||
,a.def2
|
,a.def2
|
||||||
,a.def3
|
,a.def3
|
||||||
|
@ -683,10 +685,10 @@
|
||||||
and a.businessDate <= #{businessdate_end}
|
and a.businessDate <= #{businessdate_end}
|
||||||
</if>
|
</if>
|
||||||
<if test="successfultradedate_start!=null and successfultradedate_start!=''">
|
<if test="successfultradedate_start!=null and successfultradedate_start!=''">
|
||||||
and a.successfulTradeDate >= #{successfultradedate_start}
|
and a.tradeSuccessAt >= #{successfultradedate_start}
|
||||||
</if>
|
</if>
|
||||||
<if test="successfultradedate_end!=null and successfultradedate_end!=''">
|
<if test="successfultradedate_end!=null and successfultradedate_end!=''">
|
||||||
and a.successfulTradeDate <= #{successfultradedate_end}
|
and a.tradeSuccessAt <= #{successfultradedate_end}
|
||||||
</if>
|
</if>
|
||||||
<if test="headCode!=null and headCode!=''">
|
<if test="headCode!=null and headCode!=''">
|
||||||
and b.code = #{headCode}
|
and b.code = #{headCode}
|
||||||
|
|
Loading…
Reference in New Issue