refactor(log): 优化日志输出格式并添加时间判断逻辑- 修改了多个类中的日志输出格式,使用插件名称替代固定文本
- 在 SoSaleReturnPluginInitializerToC 类中添加了时间判断方法 - 更新了多个测试类中的测试数据
This commit is contained in:
parent
79e17fd46f
commit
6489e58c64
|
@ -208,7 +208,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
|
|||
*/
|
||||
public void startImplementByTime(String startTime, String endTime) {
|
||||
long startMillis = System.currentTimeMillis();
|
||||
String threadNameStrStart = StrUtil.format("开始(代理品牌采购)OFS采购入库单生成U8C采购订单 开始时间:{} 结束时间:{}", startTime, endTime);
|
||||
String threadNameStrStart = StrUtil.format("开始 {} 开始时间:{} 结束时间:{}", getPluginName(), startTime, endTime);
|
||||
logger.info(threadNameStrStart);
|
||||
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
|
@ -258,7 +258,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
|
|||
logger.error("thread.join()异常", e);
|
||||
}
|
||||
long endMillis = System.currentTimeMillis();
|
||||
String threadNameStrEnd = StrUtil.format("结束(代理品牌采购)OFS采购入库单生成U8C采购订单 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis));
|
||||
String threadNameStrEnd = StrUtil.format("结束 {} 开始时间:{} 结束时间:{} 耗时:{}", getPluginName(), startTime, endTime, (endMillis - startMillis));
|
||||
logger.info(threadNameStrEnd);
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
|
|||
*/
|
||||
public void startImplementByCode(String code) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
String threadNameStrStart = StrUtil.format("(代理品牌采购)OFS采购入库单生成U8C采购订单开始 采购入库单号:{}", code);
|
||||
String threadNameStrStart = StrUtil.format("{} 开始 采购入库单号:{}", getPluginName(), code);
|
||||
logger.info(threadNameStrStart);
|
||||
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
|
@ -315,7 +315,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity {
|
|||
logger.error("thread.join()异常", e);
|
||||
}
|
||||
long endTime = System.currentTimeMillis();
|
||||
String threadNameStrEnd = StrUtil.format("(代理品牌采购)OFS采购入库单生成U8C采购订单结束 采购入库单号:{} 耗时:{}", code, (endTime - startTime));
|
||||
String threadNameStrEnd = StrUtil.format("{} 结束 采购入库单号:{} 耗时:{}", getPluginName(), code, (endTime - startTime));
|
||||
logger.info(threadNameStrEnd);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
@ -1301,9 +1302,12 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
}
|
||||
if (stockinH != null && stockinH.getRefundedAt() != null) {
|
||||
String refundedAt = stockinH.getRefundedAt();
|
||||
|
||||
String businessFormat = null;
|
||||
try {
|
||||
//2025年1月22日 17:44:55 先暂时还是使用旧逻辑
|
||||
Date dbill = DateUtil.parse(refundedAt);
|
||||
// Date dbill = DateUtil.parse(timeJudgment(stockinH));
|
||||
businessFormat = DateUtil.format(dbill, "yyyy-MM-dd");
|
||||
} catch (Exception e) {
|
||||
logger.error("业务日期生成失败refundedAt(O退款完成时间)解析异常:{} O售后入库单编码:{}", e.getMessage(), code);
|
||||
|
@ -1317,6 +1321,30 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 先退款后退货场景时间判断
|
||||
*/
|
||||
public String timeJudgment(StockinOrderSearchResponse.StockinOrder.StockinH stockinH) throws Exception {
|
||||
Assert.notNull(stockinH, "stockinH不能为空!");
|
||||
Assert.notNull(stockinH.getRefundedAt(), "退款完成时间不能为空 O售后入库单号:{}", stockinH.getCode());
|
||||
Assert.notNull(stockinH.getClosedAt(), "入库完成时间(关单时间)不能为空 O售后入库单号:{}", stockinH.getCode());
|
||||
//退款完成时间
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date refundedAtDate = sdf.parse(stockinH.getRefundedAt());
|
||||
|
||||
//入库完成时间
|
||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date closedAtDate = sdf2.parse(stockinH.getClosedAt());
|
||||
|
||||
if (refundedAtDate.before(closedAtDate)) {
|
||||
logger.info("O售后入库单:{} 入库时间:{} 退款完成时间:{} 「先退款」后退货", stockinH.getCode(), stockinH.getClosedAt(), stockinH.getRefundedAt());
|
||||
return stockinH.getClosedAt();
|
||||
} else {
|
||||
logger.info("O售后入库单:{} 入库时间:{} 退款完成时间:{} 「先退货」后退款", stockinH.getCode(), stockinH.getClosedAt(), stockinH.getRefundedAt());
|
||||
return stockinH.getRefundedAt();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 档案转换(OFS->U8C)
|
||||
*
|
||||
|
|
|
@ -27,7 +27,7 @@ public class ConsignmachiningInReturnTest {
|
|||
@Test
|
||||
public void startImplement() {
|
||||
try {
|
||||
consignmachiningInReturn.startImplement("LETS-SH2025010800023052");
|
||||
consignmachiningInReturn.startImplement("LETS-SH2025012200021108");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class ConsignmachiningInTest {
|
|||
@Test
|
||||
public void startImplement() {
|
||||
// String code = "LETS-RE2024082300000007";
|
||||
String code = "LETS-RE2024120400000857";
|
||||
String code = "LETS-RE2025012000001264";
|
||||
consignmachiningIn.startImplement(code);
|
||||
|
||||
// consignmachiningIn.startImplement("2024-09-24 13:49:15", "2024-09-24 13:49:17");
|
||||
|
|
|
@ -27,9 +27,9 @@ public class ProxyPurchaseWarehousOrderTest {
|
|||
@Test
|
||||
public void startImplementByCode() {
|
||||
try {
|
||||
proxyPurchaseWarehousOrder.startImplementByCode("LETS-PO2025010200000001");
|
||||
// proxyPurchaseWarehousOrder.startImplementByCode("LETS-PO2025010200000001");
|
||||
|
||||
// proxyPurchaseWarehousOrder.startImplementByTime("2024-12-23 15:32:39", "2024-12-23 15:32:39");
|
||||
proxyPurchaseWarehousOrder.startImplementByTime("2025-01-13 00:00:00", "2025-01-13 23:59:59");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -83,8 +83,8 @@ public class SoSaleOutPluginInitializerToBTest {
|
|||
|
||||
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-23 16:09:59", "2024-10-23 16:10:01");
|
||||
|
||||
String aaa = "LETS-SH2024103100026169";
|
||||
soSaleOutPluginInitializerToB.startImplementByCode(aaa, "tran");
|
||||
// String aaa = "LETS-SH2024103100026169";
|
||||
// soSaleOutPluginInitializerToB.startImplementByCode(aaa, "tran");
|
||||
// soSaleOutPluginInitializerToB.startImplementByTranTime("2024-10-28 00:00:00", "2024-10-28 23:59:59");
|
||||
|
||||
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-10-31 14:48:41", "2024-10-31 14:48:41");
|
||||
|
@ -95,7 +95,7 @@ public class SoSaleOutPluginInitializerToBTest {
|
|||
// soSaleOutPluginInitializerToB.startImplementByStockTime("2024-11-08 19:18:02", "2024-11-08 19:18:02");
|
||||
|
||||
|
||||
// soSaleOutPluginInitializerToB.startImplementByTranTime("2000-11-08 19:18:02", "2000-11-08 19:18:02");
|
||||
soSaleOutPluginInitializerToB.startImplementByTranTime("2025-01-10 19:39:27", "2025-01-10 19:39:27");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ class SoSaleOutPluginInitializerToCTest {
|
|||
// soSaleOutPluginInitializerToC.startImplementStockByCode(aaa, "tran");
|
||||
|
||||
// String aaa = "LETS-SH2024102800021196";
|
||||
// soSaleOutPluginInitializerToC.startImplementTranByTime("2024-11-13 11:30:41", "2024-11-13 11:30:41", "0");
|
||||
soSaleOutPluginInitializerToC.startImplementTranByTime("2025-01-15 20:47:55", "2025-01-15 20:47:55", "0");
|
||||
|
||||
// soSaleOutPluginInitializerToC.startImplementStockByTime("2024-12-24 21:53:57", "2024-12-24 21:53:57", "2");
|
||||
} catch (Exception e) {
|
||||
|
@ -129,7 +129,7 @@ class SoSaleOutPluginInitializerToCTest {
|
|||
|
||||
try {
|
||||
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110200030366", "stock");
|
||||
soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2025010100023112", "tran");
|
||||
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2025011300024220", "tran");
|
||||
|
||||
// soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024111700013756", "tran");
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.hzya.frame.WebappApplication;
|
|||
import com.hzya.frame.plugin.lets.entity.BdBusitypeEntity;
|
||||
import com.hzya.frame.plugin.lets.queryvo.StartAndEndVo;
|
||||
import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil;
|
||||
import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -47,7 +48,7 @@ public class SoSaleReturnPluginInitializerToCTest {
|
|||
try {
|
||||
// soSaleReturnPluginInitializerToC.startImplementByTradeTime("2024-12-23 23:05:34", "2024-12-23 23:05:34", "2");
|
||||
|
||||
soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2024122800000084", "stock");
|
||||
soSaleReturnPluginInitializerToC.startImplementByCode("LETS-RE2025010900002384", "tran");
|
||||
|
||||
// soSaleReturnPluginInitializerToC.startImplementStockByTime("2024-12-24 16:02:17", "2024-12-24 16:02:17", "0");
|
||||
|
||||
|
@ -55,6 +56,21 @@ public class SoSaleReturnPluginInitializerToCTest {
|
|||
// soSaleReturnPluginInitializerToC.executeBusiness(jsonObject);
|
||||
|
||||
// soSaleReturnPluginInitializerToC.startImplementByTradeTime("2024-11-01 00:00:00", "2024-11-05 23:59:59");
|
||||
|
||||
// StockinOrderSearchResponse.StockinOrder stockinOrder = new StockinOrderSearchResponse.StockinOrder();
|
||||
|
||||
//先退款后退货 -> 取退货时间
|
||||
// StockinOrderSearchResponse.StockinOrder.StockinH header = new StockinOrderSearchResponse.StockinOrder.StockinH();
|
||||
// header.setRefundedAt("2025-01-02 17:00:00");
|
||||
// header.setClosedAt("2025-01-03 12:01:00");
|
||||
//
|
||||
// //先退货后退款 -> 取退款时间
|
||||
// StockinOrderSearchResponse.StockinOrder.StockinH header2 = new StockinOrderSearchResponse.StockinOrder.StockinH();
|
||||
// header2.setRefundedAt("2025-01-04 17:00:00");
|
||||
// header2.setClosedAt("2025-01-03 12:01:00");
|
||||
//
|
||||
// String s = soSaleReturnPluginInitializerToC.timeJudgment(header2);
|
||||
// System.out.println(s);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue