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

committer: heyu
This commit is contained in:
aike 2025-09-02 17:45:09 +08:00
parent a7cc295f03
commit 8225994be5
5 changed files with 127 additions and 7 deletions

View File

@ -1,11 +1,11 @@
/**
/**
* @Project: emis
* @Title: EmisWaybillController.java
* @author linfso
* @date 2024-02-29 08:15:14
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @version v1.0
* @Description: <p> 运单列表 控制器 </p>
*/
@ -59,7 +59,7 @@ import com.xdadan.erp.common.enums.BusinessType;
/**
* 运单列表Controller
*
*
* @author linfso
* @date 2024-02-29 08:15:14
*/
@ -1443,4 +1443,68 @@ public class EmisWaybillController extends EmisBaseController
// FileUtil.mkdir(fileUploadDir);
}
@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";
// 构建查询条件
EmisWaybill queryWaybill = new EmisWaybill();
queryWaybill.getParams().put("beginOrderDate", beginDate);
queryWaybill.getParams().put("endOrderDate", endDate);
// 未签收条件:bl_sign != '1' 或者 waybill_status != '50'(签收扫描)
queryWaybill.getParams().put("notSigned", "1");
// 在问题表中的条件
queryWaybill.getParams().put("inProblemTable", "1");
List<EmisWaybill> waybillList = emisWaybillService.selectProblemWaybillsForResubmit(queryWaybill);
if (waybillList == null || waybillList.isEmpty()) {
return AjaxResult.success("没有找到符合条件的运单");
}
JSONObject result = new JSONObject();
List<JSONObject> successList = new ArrayList<>();
List<JSONObject> failList = new ArrayList<>();
for (EmisWaybill waybill : waybillList) {
try {
// 调用realSubmitOrder方法重新下单
emisWaybillService.realSubmitOrder(waybill);
JSONObject successItem = new JSONObject();
successItem.put("billCode", waybill.getBillCode());
successItem.put("orderSn", waybill.getOrderSn());
successItem.put("message", "重新下单成功");
successList.add(successItem);
} catch (Exception ex) {
JSONObject failItem = new JSONObject();
failItem.put("billCode", waybill.getBillCode());
failItem.put("orderSn", waybill.getOrderSn());
failItem.put("message", ex.getMessage());
failList.add(failItem);
log.error("运单{}重新下单失败: {}", waybill.getBillCode(), ex.getMessage());
}
}
result.put("totalCount", waybillList.size());
result.put("successCount", successList.size());
result.put("failCount", failList.size());
result.put("successList", successList);
result.put("failList", failList);
return AjaxResult.success("批量重新下单完成", result);
} catch (Exception ex) {
log.error("批量重新下单问题运单失败", ex);
return AjaxResult.error("批量重新下单失败: " + ex.getMessage());
}
}
}

View File

@ -347,4 +347,12 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
* @return
*/
List<EmisWaybill> selectHistoryVirtualWaybill(@Param("offset")int offset, @Param("pageSize")int pageSize);
/**
* 查询指定时间范围内未签收且在问题表中的运单信息
*
* @param emisWaybill 查询条件
* @return 运单列表
*/
List<EmisWaybill> selectProblemWaybillsForResubmit(EmisWaybill emisWaybill);
}

View File

@ -1,10 +1,10 @@
/**
/**
* @Project: emis
* @Title: EmisWaybillService.java
* @author linfso
* @date 2024-02-29 08:15:14
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @version v1.0
* @Description: <p> 运单列表 服务类接口 </p>
*/
package com.xdadan.erp.emis.service;
@ -61,7 +61,7 @@ public interface IEmisWaybillService extends IDataAuditService
/**
* 查询运单列表列表
*
*
* @param emisWaybill 运单列表
* @return 运单列表集合
*/
@ -312,4 +312,12 @@ public interface IEmisWaybillService extends IDataAuditService
* @param emisWaybills
*/
void handleInputVirtualWaybill(List<EmisWaybill> emisWaybills);
/**
* 查询指定时间范围内未签收且在问题表中的运单信息
*
* @param emisWaybill 查询条件
* @return 运单列表
*/
List<EmisWaybill> selectProblemWaybillsForResubmit(EmisWaybill emisWaybill);
}

View File

@ -6248,6 +6248,15 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
}
/**
* 查询指定时间范围内未签收且在问题表中的运单信息
*
* @param emisWaybill 查询条件
* @return 运单列表
*/
@Override
public List<EmisWaybill> selectProblemWaybillsForResubmit(EmisWaybill emisWaybill) {
return emisWaybillMapper.selectProblemWaybillsForResubmit(emisWaybill);
}
}

View File

@ -3929,4 +3929,35 @@
</if>
limit 1
</select>
<!-- 查询指定时间范围内未签收且在问题表中的运单信息 -->
<select id="selectProblemWaybillsForResubmit" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
<where>
a.del_flag='0'
<!-- 时间范围条件 -->
<if test="params.beginOrderDate != null and params.beginOrderDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginOrderDate}
</if>
<if test="params.endOrderDate != null and params.endOrderDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endOrderDate}
</if>
<!-- 未签收条件:bl_sign != '1' 或者 waybill_status != '50'(签收扫描) -->
<if test="params.notSigned != null and params.notSigned == '1'">
and (a.bl_sign != '1' or a.bl_sign is null)
</if>
<!-- 在问题表中的条件 -->
<if test="params.inProblemTable != null and params.inProblemTable == '1'">
and exists (
select 1 from emis_waybill_problem_info p
where a.bill_code = p.bill_code
and p.del_flag = '0'
)
</if>
</where>
order by a.order_date desc
</select>
</mapper>