Merge pull request 'develop' (#140) from develop into master
Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/140
This commit is contained in:
commit
0e8bd434b1
@ -5258,18 +5258,61 @@ public class EmisBaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新主运单的虚拟运单备注信息
|
||||||
|
* @param emisWaybillSave 当前运单信息
|
||||||
|
* @param masterBillCode 主运单号
|
||||||
|
*/
|
||||||
private void updateOldMasterBill(EmisWaybill emisWaybillSave, String masterBillCode) {
|
private void updateOldMasterBill(EmisWaybill emisWaybillSave, String masterBillCode) {
|
||||||
String virtualBillCode = emisWaybillSave.getBillCode();
|
// 参数校验
|
||||||
EmisWaybill masterWaybill = emisWaybillMapper
|
if (emisWaybillSave == null || StringUtil.isBlank(masterBillCode)) {
|
||||||
.selectEmisWaybillByBillCode(masterBillCode);
|
log.warn("updateOldMasterBill参数为空,emisWaybillSave: {}, masterBillCode: {}",
|
||||||
List<String> filterVirtualRemark = Arrays.stream(masterWaybill.getVirtualRemark().split(","))
|
emisWaybillSave, masterBillCode);
|
||||||
.filter(i -> !i.equals(virtualBillCode)).collect(Collectors.toList());
|
return;
|
||||||
String virtualRemark = String.join(",", filterVirtualRemark);
|
|
||||||
if(StringUtil.isBlank(virtualRemark)) {
|
|
||||||
virtualRemark = " ";
|
|
||||||
}
|
}
|
||||||
masterWaybill.setVirtualRemark(virtualRemark);
|
|
||||||
|
String virtualBillCode = emisWaybillSave.getBillCode();
|
||||||
|
if (StringUtil.isBlank(virtualBillCode)) {
|
||||||
|
log.warn("虚拟运单号为空,无法更新主运单信息");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询主运单信息
|
||||||
|
EmisWaybill masterWaybill = emisWaybillMapper.selectEmisWaybillByBillCode(masterBillCode);
|
||||||
|
if (masterWaybill == null) {
|
||||||
|
log.warn("未找到主运单信息,masterBillCode: {}", masterBillCode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理虚拟运单备注信息
|
||||||
|
String currentVirtualRemark = masterWaybill.getVirtualRemark();
|
||||||
|
List<String> virtualBillCodes = new ArrayList<>();
|
||||||
|
|
||||||
|
// 如果当前虚拟备注不为空,则解析现有运单号列表
|
||||||
|
if (StringUtil.isNotBlank(currentVirtualRemark)) {
|
||||||
|
virtualBillCodes = Arrays.stream(currentVirtualRemark.split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.filter(StringUtil::isNotBlank)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 移除当前虚拟运单号
|
||||||
|
virtualBillCodes.removeIf(code -> virtualBillCode.equals(code));
|
||||||
|
|
||||||
|
// 重新构建虚拟备注字符串
|
||||||
|
String newVirtualRemark;
|
||||||
|
if (virtualBillCodes.isEmpty()) {
|
||||||
|
newVirtualRemark = " ";
|
||||||
|
} else {
|
||||||
|
newVirtualRemark = String.join(",", virtualBillCodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新主运单信息
|
||||||
|
masterWaybill.setVirtualRemark(newVirtualRemark);
|
||||||
emisWaybillMapper.updateEmisWaybill(masterWaybill);
|
emisWaybillMapper.updateEmisWaybill(masterWaybill);
|
||||||
|
|
||||||
|
log.debug("成功更新主运单虚拟备注,masterBillCode: {}, 移除运单号: {}, 新备注: {}",
|
||||||
|
masterBillCode, virtualBillCode, newVirtualRemark);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws ParseException {
|
public static void main(String[] args) throws ParseException {
|
||||||
|
|||||||
@ -205,10 +205,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
and w.send_date <![CDATA[ <= ]]> #{params.endSendDate}
|
and w.send_date <![CDATA[ <= ]]> #{params.endSendDate}
|
||||||
</if>
|
</if>
|
||||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||||
and (w.start_site_code=#{params.privSiteCode} or w.send_site_code=#{params.privSiteCode})
|
and (w.start_site_code=#{params.privSiteCode} or w.send_site_code=#{params.privSiteCode} or m.start_site_code=#{params.privSiteCode} or m.next_site_code=#{params.privSiteCode})
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by w.bill_code desc
|
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
<include refid="selectEmisTmsSiteBatchMissVo"/>
|
<include refid="selectEmisTmsSiteBatchMissVo"/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user