demand: tms-运单管理-新增批量修改运单接口-批量修复历史数据预计送达时间计算不准确的运单。

committer: heyu
This commit is contained in:
aike 2025-09-02 18:12:52 +08:00
parent 8225994be5
commit 5460b3b071

View File

@ -33,6 +33,7 @@ import com.xdadan.erp.emis.domain.enumtype.ScanType;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.stat.ScanStatInfoDtl;
import com.xdadan.erp.emis.domain.vo.*;
import com.xdadan.erp.emis.mapper.EmisWaybillMapper;
import com.xdadan.erp.emis.service.*;
import com.xdadan.erp.emis.service.print.IXddTplPrint;
import com.xdadan.erp.emis.service.print.cpcl.CvtTplToCpcl;
@ -101,6 +102,9 @@ public class EmisWaybillController extends EmisBaseController
@Autowired
RedissonService redissonService;
@Autowired
private EmisWaybillMapper emisWaybillMapper;
@GetMapping(value = "/checkWaybillIsExists")
public AjaxResult checkWaybillIsExists(String billCode){
@ -1443,12 +1447,13 @@ public class EmisWaybillController extends EmisBaseController
// FileUtil.mkdir(fileUploadDir);
}
@Log(title = "批量修改运单", businessType = BusinessType.UPDATE)
@Log(title = "批量更新预估到达时间", businessType = BusinessType.UPDATE)
@PostMapping(value = "/batchResubmitProblemWaybills")
public AjaxResult batchResubmitProblemWaybills() {
try {
// 查询2025-08-01 00:00:00-2025-09-03
// 23:59:59未签收,且在emis_waybill_problem_info表内的所有运单信息
// 重新计算并更新预估到达时间
String beginDate = "2025-08-01 00:00:00";
String endDate = "2025-09-03 23:59:59";
@ -1473,13 +1478,26 @@ public class EmisWaybillController extends EmisBaseController
for (EmisWaybill waybill : waybillList) {
try {
// 调用realSubmitOrder方法重新下单
emisWaybillService.realSubmitOrder(waybill);
// 重新计算预估到达时间
Date newEstimateDate = emisBaseService.getEstimateDate(
waybill.getSendDate(),
waybill.getProductType(),
waybill.getSendCountry(),
waybill.getReceiveCountry(),
0);
// 只更新estimateDate字段
EmisWaybill updateWaybill = new EmisWaybill();
updateWaybill.setId(waybill.getId());
updateWaybill.setEstimateDate(newEstimateDate);
updateWaybill.preUpdate();
emisWaybillMapper.updateVirtualWaybill(updateWaybill);
JSONObject successItem = new JSONObject();
successItem.put("billCode", waybill.getBillCode());
successItem.put("orderSn", waybill.getOrderSn());
successItem.put("message", "重新下单成功");
successItem.put("message", "预估到达时间更新成功");
successList.add(successItem);
} catch (Exception ex) {
@ -1489,7 +1507,7 @@ public class EmisWaybillController extends EmisBaseController
failItem.put("message", ex.getMessage());
failList.add(failItem);
log.error("运单{}重新下单失败: {}", waybill.getBillCode(), ex.getMessage());
log.error("运单{}预估到达时间更新失败: {}", waybill.getBillCode(), ex.getMessage());
}
}
@ -1499,11 +1517,11 @@ public class EmisWaybillController extends EmisBaseController
result.put("successList", successList);
result.put("failList", failList);
return AjaxResult.success("批量重新下单完成", result);
return AjaxResult.success("批量更新预估到达时间完成", result);
} catch (Exception ex) {
log.error("批量重新下单问题运单失败", ex);
return AjaxResult.error("批量重新下单失败: " + ex.getMessage());
log.error("批量更新预估到达时间失败", ex);
return AjaxResult.error("批量更新预估到达时间失败: " + ex.getMessage());
}
}