demand: TMS系统 - 客户管理 - 现金客户额度 - 超期已用额度 与运单明细单号运费不一致;
committer: heyu
This commit is contained in:
parent
eeefc44f86
commit
413aefda36
@ -2845,7 +2845,13 @@ public class EmisBaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtil.isNotBlank(waybill.getVirtualRemark())) {
|
if (StringUtil.isNotBlank(waybill.getVirtualRemark())) {
|
||||||
remark = remark + " " + "该运单为主单,对应虚拟单为" + waybill.getVirtualRemark();
|
// 取每个虚拟单号的后六位,用逗号拼接
|
||||||
|
String[] codes = waybill.getVirtualRemark().split(",");
|
||||||
|
String shortCodes = Arrays.stream(codes)
|
||||||
|
.filter(s -> s != null && s.length() >= 6)
|
||||||
|
.map(s -> s.substring(s.length() - 6))
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
remark = remark + " " + "该运单为主单,对应虚拟单为" + shortCodes;
|
||||||
}
|
}
|
||||||
// if (StringUtil.isNotBlank(waybill.getMasterBillCode())) {
|
// if (StringUtil.isNotBlank(waybill.getMasterBillCode())) {
|
||||||
// remark = remark + " " + "该运单为虚拟单,对应主单为" + waybill.getMasterBillCode();
|
// remark = remark + " " + "该运单为虚拟单,对应主单为" + waybill.getMasterBillCode();
|
||||||
@ -4787,10 +4793,10 @@ public class EmisBaseService {
|
|||||||
}
|
}
|
||||||
updateMasterWaybill(emisWaybillSave,emisWaybillOld);
|
updateMasterWaybill(emisWaybillSave,emisWaybillOld);
|
||||||
// 做问题件录入
|
// 做问题件录入
|
||||||
scanProblemInfo(emisWaybillSave);
|
scanProblemInfo(emisWaybillSave,emisWaybillOld);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void scanProblemInfo(EmisWaybill emisWaybillSave) {
|
public void scanProblemInfo(EmisWaybill emisWaybillSave, EmisWaybill emisWaybillOld) {
|
||||||
String dispatchOrSendManCode = "";
|
String dispatchOrSendManCode = "";
|
||||||
if ("1".equals(emisWaybillSave.getPickupMethod())) {
|
if ("1".equals(emisWaybillSave.getPickupMethod())) {
|
||||||
dispatchOrSendManCode = emisWaybillSave.getOperateEmployeeCode();
|
dispatchOrSendManCode = emisWaybillSave.getOperateEmployeeCode();
|
||||||
@ -4812,7 +4818,11 @@ public class EmisBaseService {
|
|||||||
scanDatePromItem.put("remark", "返货虚拟面单");
|
scanDatePromItem.put("remark", "返货虚拟面单");
|
||||||
}
|
}
|
||||||
scanDatePromItem.put("notifySite", emisWaybillSave.getSendSiteCode());
|
scanDatePromItem.put("notifySite", emisWaybillSave.getSendSiteCode());
|
||||||
|
if (null == emisWaybillOld) {
|
||||||
scanDatePromItem.put("scanDate", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, emisWaybillSave.getSendDate()));
|
scanDatePromItem.put("scanDate", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, emisWaybillSave.getSendDate()));
|
||||||
|
} else {
|
||||||
|
scanDatePromItem.put("scanDate", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getNowDate()));
|
||||||
|
}
|
||||||
scanDatePromItem.put("scanWeight", "0.0");
|
scanDatePromItem.put("scanWeight", "0.0");
|
||||||
scanDataPromList.add(scanDatePromItem);
|
scanDataPromList.add(scanDatePromItem);
|
||||||
scanInfoProm.setScanData(scanDataPromList);
|
scanInfoProm.setScanData(scanDataPromList);
|
||||||
@ -4843,12 +4853,21 @@ public class EmisBaseService {
|
|||||||
if (StringUtil.isBlank(emisWaybillSave.getMasterBillCode())) {
|
if (StringUtil.isBlank(emisWaybillSave.getMasterBillCode())) {
|
||||||
throw new EmisBizError(EmisBizErrorType.FAIL, "主单号不能为空");
|
throw new EmisBizError(EmisBizErrorType.FAIL, "主单号不能为空");
|
||||||
}
|
}
|
||||||
|
if(StringUtil.isNotBlank(emisWaybillOld.getVirtualRemark())){
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL, "主单不能改虚拟单");
|
||||||
|
}
|
||||||
|
if (emisWaybillSave.getParcelQty() != 1) {
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL, "虚拟单件数只能为1");
|
||||||
|
}
|
||||||
|
if (emisWaybillSave.getMasterBillCode().equals(emisWaybillSave.getBillCode())) {
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL, "运单号主单号不能相同");
|
||||||
|
}
|
||||||
if (!"002".equals(emisWaybillSave.getTransLineType()) && !"012".equals(emisWaybillSave.getTransLineType())
|
if (!"002".equals(emisWaybillSave.getTransLineType()) && !"012".equals(emisWaybillSave.getTransLineType())
|
||||||
&& !"014".equals(emisWaybillSave.getTransLineType())) {
|
&& !"014".equals(emisWaybillSave.getTransLineType())) {
|
||||||
throw new EmisBizError(EmisBizErrorType.FAIL, "虚拟单只支持线路为缅甸快递/缅甸快递进口/柬埔寨快递进口");
|
throw new EmisBizError(EmisBizErrorType.FAIL, "虚拟单只支持线路为缅甸快递/缅甸快递进口/柬埔寨快递进口");
|
||||||
}
|
}
|
||||||
EmisWaybill masterWaybill = emisWaybillMapper
|
EmisWaybill masterWaybill = emisWaybillMapper
|
||||||
.selectEmisWaybillByBillCode(emisWaybillSave.getMasterBillCode());
|
.selectMasterWaybillByBillCode(emisWaybillSave.getMasterBillCode());
|
||||||
if (Objects.isNull(masterWaybill)) {
|
if (Objects.isNull(masterWaybill)) {
|
||||||
throw new EmisBizError(EmisBizErrorType.FAIL, "主单号不存在");
|
throw new EmisBizError(EmisBizErrorType.FAIL, "主单号不存在");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3236,7 +3236,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
|||||||
|
|
||||||
// 问题件逻辑
|
// 问题件逻辑
|
||||||
if ("1".equals(emisWaybillSave.getBlVirtual())) {
|
if ("1".equals(emisWaybillSave.getBlVirtual())) {
|
||||||
scanProblemInfo(emisWaybillSave);
|
scanProblemInfo(emisWaybillSave, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 运单立即重新出账
|
// 运单立即重新出账
|
||||||
@ -5918,30 +5918,55 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleProblem(failedBillCodes, filterForProblemCodes, failedBills,successCount,failCount);
|
// 修正:handleProblem返回统计结果
|
||||||
|
ProblemHandleResult problemResult = handleProblem(failedBillCodes, filterForProblemCodes, failedBills,
|
||||||
|
successCount, failCount);
|
||||||
|
if (problemResult != null) {
|
||||||
|
successCount = problemResult.successCount;
|
||||||
|
failCount = problemResult.failCount;
|
||||||
|
filterForProblemCodes = problemResult.filterForProblemCodes;
|
||||||
|
}
|
||||||
|
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
long processTime = endTime - startTime;
|
long processTime = endTime - startTime;
|
||||||
|
|
||||||
log.debug("处理完成,总处理数:{},成功数:{},失败数:{},耗时:{}ms",
|
log.debug("处理完成,总处理数:{},成功数:{},失败数:{},耗时:{}ms", totalProcessed, successCount, failCount, processTime);
|
||||||
totalProcessed, successCount, failCount, processTime);
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(failedBillCodes)) {
|
if (CollectionUtil.isNotEmpty(failedBillCodes)) {
|
||||||
log.debug("Failed bill codes: {}", failedBillCodes);
|
log.debug("Failed bill codes ({}): {}", failedBillCodes.size(), failedBillCodes);
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(filterForProblemCodes)) {
|
if (CollectionUtil.isNotEmpty(filterForProblemCodes)) {
|
||||||
log.debug("Failed for problemCodes: {}", filterForProblemCodes);
|
log.debug("Failed for problemCodes ({}): {}", filterForProblemCodes.size(), filterForProblemCodes);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error in autoScanSiteBatch", e);
|
log.error("Error in autoScanSiteBatch", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleProblem(List<String> failedBillCodes, List<String> filterForProblemCodes, List<EmisWaybill> failedBills, int successCount, int failCount) {
|
// 新增内部类用于返回统计结果
|
||||||
List<EmisWaybillProblemInfo> emisWaybillProblemInfos = emisWaybillProblemInfoMapper.selectEmisWaybillProblemInfoByBillCodes(failedBillCodes);
|
private static class ProblemHandleResult {
|
||||||
|
int successCount;
|
||||||
|
int failCount;
|
||||||
|
List<String> filterForProblemCodes;
|
||||||
|
|
||||||
|
ProblemHandleResult(int successCount, int failCount, List<String> filterForProblemCodes) {
|
||||||
|
this.successCount = successCount;
|
||||||
|
this.failCount = failCount;
|
||||||
|
this.filterForProblemCodes = filterForProblemCodes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改handleProblem返回统计结果
|
||||||
|
private ProblemHandleResult handleProblem(List<String> failedBillCodes, List<String> filterForProblemCodes,
|
||||||
|
List<EmisWaybill> failedBills, int successCount, int failCount) {
|
||||||
|
if (CollectionUtil.isEmpty(failedBillCodes)) {
|
||||||
|
return new ProblemHandleResult(successCount, failCount, filterForProblemCodes);
|
||||||
|
}
|
||||||
|
List<EmisWaybillProblemInfo> emisWaybillProblemInfos = emisWaybillProblemInfoMapper
|
||||||
|
.selectEmisWaybillProblemInfoByBillCodes(failedBillCodes);
|
||||||
if (emisWaybillProblemInfos == null) {
|
if (emisWaybillProblemInfos == null) {
|
||||||
log.error("emisWaybillProblemInfos is null");
|
log.error("emisWaybillProblemInfos is null");
|
||||||
return;
|
return new ProblemHandleResult(successCount, failCount, filterForProblemCodes);
|
||||||
}
|
}
|
||||||
for (EmisWaybillProblemInfo emisWaybillProblemInfo : emisWaybillProblemInfos) {
|
for (EmisWaybillProblemInfo emisWaybillProblemInfo : emisWaybillProblemInfos) {
|
||||||
try {
|
try {
|
||||||
@ -5955,7 +5980,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
|||||||
filterForProblemCodes.add(emisWaybillProblemInfo.getBillCode());
|
filterForProblemCodes.add(emisWaybillProblemInfo.getBillCode());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<EmisWaybill> fiterBills = failedBills.stream().filter(i -> i.getBillCode().equals(emisWaybillProblemInfo.getBillCode())).collect(Collectors.toList());
|
List<EmisWaybill> fiterBills = failedBills.stream()
|
||||||
|
.filter(i -> i.getBillCode().equals(emisWaybillProblemInfo.getBillCode()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
EmisWaybill waybill = new EmisWaybill();
|
EmisWaybill waybill = new EmisWaybill();
|
||||||
waybill.setMasterBillCode(masterBillCode);
|
waybill.setMasterBillCode(masterBillCode);
|
||||||
waybill.setId(fiterBills.get(0).getId());
|
waybill.setId(fiterBills.get(0).getId());
|
||||||
@ -5968,8 +5995,8 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
|||||||
log.error("处理问题件失败,运单号:{},错误:{}", emisWaybillProblemInfo.getBillCode(), e.getMessage());
|
log.error("处理问题件失败,运单号:{},错误:{}", emisWaybillProblemInfo.getBillCode(), e.getMessage());
|
||||||
filterForProblemCodes.add(emisWaybillProblemInfo.getBillCode());
|
filterForProblemCodes.add(emisWaybillProblemInfo.getBillCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return new ProblemHandleResult(successCount, failCount, filterForProblemCodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateWaybill(EmisWaybill virtualWaybill) {
|
private void updateWaybill(EmisWaybill virtualWaybill) {
|
||||||
@ -5977,15 +6004,14 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
|||||||
.selectMasterWaybillByBillCode(virtualWaybill.getMasterBillCode());
|
.selectMasterWaybillByBillCode(virtualWaybill.getMasterBillCode());
|
||||||
String virtualRemark = masterWaybill.getVirtualRemark();
|
String virtualRemark = masterWaybill.getVirtualRemark();
|
||||||
String virtualBillCode = virtualWaybill.getBillCode();
|
String virtualBillCode = virtualWaybill.getBillCode();
|
||||||
String virtualBillCodeLastSix = virtualBillCode.substring(virtualBillCode.length() - 6);
|
|
||||||
if (StringUtil.isNotBlank(virtualRemark)) {
|
if (StringUtil.isNotBlank(virtualRemark)) {
|
||||||
Set<String> virtualBillSet = new LinkedHashSet<>();
|
Set<String> virtualBillSet = new LinkedHashSet<>();
|
||||||
String[] codes = virtualRemark.split(",");
|
String[] codes = virtualRemark.split(",");
|
||||||
virtualBillSet.addAll(Arrays.asList(codes));
|
virtualBillSet.addAll(Arrays.asList(codes));
|
||||||
virtualBillSet.add(virtualBillCodeLastSix);
|
virtualBillSet.add(virtualBillCode);
|
||||||
virtualRemark = String.join(",", virtualBillSet);
|
virtualRemark = String.join(",", virtualBillSet);
|
||||||
} else {
|
} else {
|
||||||
virtualRemark = virtualBillCodeLastSix;
|
virtualRemark = virtualBillCode;
|
||||||
}
|
}
|
||||||
EmisWaybill updateMasterWaybill = new EmisWaybill();
|
EmisWaybill updateMasterWaybill = new EmisWaybill();
|
||||||
updateMasterWaybill.setVirtualRemark(virtualRemark);
|
updateMasterWaybill.setVirtualRemark(virtualRemark);
|
||||||
|
|||||||
@ -503,9 +503,9 @@
|
|||||||
<!--根据运单号获取运单信息 or FIND_IN_SET(#{billCode},bill_code_sub)-->
|
<!--根据运单号获取运单信息 or FIND_IN_SET(#{billCode},bill_code_sub)-->
|
||||||
<select id="selectMasterWaybillByBillCode" parameterType="String" resultMap="EmisWaybillResult">
|
<select id="selectMasterWaybillByBillCode" parameterType="String" resultMap="EmisWaybillResult">
|
||||||
select
|
select
|
||||||
id,virtual_remark FROM emis_waybill
|
a.* FROM emis_waybill a
|
||||||
<where>
|
<where>
|
||||||
bill_code = #{billCode}
|
a.bill_code = #{billCode}
|
||||||
</where>
|
</where>
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
@ -584,6 +584,8 @@
|
|||||||
<if test="billCode != null and billCode != ''">
|
<if test="billCode != null and billCode != ''">
|
||||||
and a.bill_code like concat('%', #{billCode}, '%')
|
and a.bill_code like concat('%', #{billCode}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
and a.order_status != '0'
|
||||||
|
and a.order_status != '2'
|
||||||
<!-- <if test="params.privSiteCode != null and params.privSiteCode != '88888'">-->
|
<!-- <if test="params.privSiteCode != null and params.privSiteCode != '88888'">-->
|
||||||
<!-- and (-->
|
<!-- and (-->
|
||||||
<!-- a.send_site_code=#{params.privSiteCode}-->
|
<!-- a.send_site_code=#{params.privSiteCode}-->
|
||||||
@ -3794,8 +3796,8 @@
|
|||||||
from emis_waybill a
|
from emis_waybill a
|
||||||
where a.del_flag = '0' and
|
where a.del_flag = '0' and
|
||||||
a.problem_type in (173,170)
|
a.problem_type in (173,170)
|
||||||
and master_bill_code is null
|
and (master_bill_code is null or master_bill_code='')
|
||||||
-- and a.bill_code ='7080300044761'
|
-- and a.bill_code ='T708030039025903'
|
||||||
order by a.create_time desc
|
order by a.create_time desc
|
||||||
limit #{offset}, #{pageSize}
|
limit #{offset}, #{pageSize}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user