Merge pull request 'demand: 新增组批次成功运单过滤重复运单,查询漏组批次运单过滤出口虚拟单的主单' (#108) from develop into master

Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/108
This commit is contained in:
heyu 2025-07-10 10:50:33 +08:00
commit 1c7ac79df3
4 changed files with 50 additions and 41 deletions

View File

@ -128,4 +128,10 @@ public class EmisTmsSiteBatchMiss extends BaseEntity {
private String blIsQuestion;
private String virtualRemark;
private Integer problemType;
/* 目的地网点代码 */
private String dispatchUnderlingSiteCode;
// 目的地网点名称
@TableField(exist = false)
@DataAuditField(fieldComment = "目的网点名称")
private String dispatchUnderlingSiteName;
}

View File

@ -84,42 +84,42 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
list = emisTmsSiteBatchMissMapper.selectEmisTmsSiteBatchMissList(emisTmsSiteBatchMiss);
}
// 收集所有virtualRemark中的单号
Set<String> relatedBillCodes = new HashSet<>();
for (EmisTmsSiteBatchMiss miss : list) {
String virtualRemark = miss.getVirtualRemark();
if (virtualRemark != null && !virtualRemark.trim().isEmpty()) {
String[] codes = virtualRemark.split(",");
for (String code : codes) {
relatedBillCodes.add(code.trim());
}
}
}
if (CollectionUtil.isEmpty(relatedBillCodes)) {
return list;
}
// 批量查找相关单号
List<EmisWaybill> relatedList = relatedBillCodes.isEmpty() ? Collections.emptyList()
: emisTmsSiteBatchMissMapper.selectByBillCodes(new ArrayList<>(relatedBillCodes));
Map<String, EmisWaybill> relatedMap = relatedList.stream()
.collect(Collectors.toMap(EmisWaybill::getBillCode, Function.identity(), (a, b) -> a));
// 过滤逻辑
list = list.stream()
.filter(wb -> {
String virtualRemark = wb.getVirtualRemark();
if (virtualRemark == null || virtualRemark.trim().isEmpty()) {
return true;
}
String[] relatedNos = virtualRemark.split(",");
for (String no : relatedNos) {
EmisWaybill related = relatedMap.get(no.trim());
if (related != null && Integer.valueOf(173).equals(related.getProblemType())) {
return false;
}
}
return true;
})
.collect(Collectors.toList());
// // 收集所有virtualRemark中的单号
// Set<String> relatedBillCodes = new HashSet<>();
// for (EmisTmsSiteBatchMiss miss : list) {
// String virtualRemark = miss.getVirtualRemark();
// if (virtualRemark != null && !virtualRemark.trim().isEmpty()) {
// String[] codes = virtualRemark.split(",");
// for (String code : codes) {
// relatedBillCodes.add(code.trim());
// }
// }
// }
// if (CollectionUtil.isEmpty(relatedBillCodes)) {
// return list;
// }
// // 批量查找相关单号
// List<EmisWaybill> relatedList = relatedBillCodes.isEmpty() ? Collections.emptyList()
// : emisTmsSiteBatchMissMapper.selectByBillCodes(new ArrayList<>(relatedBillCodes));
// Map<String, EmisWaybill> relatedMap = relatedList.stream()
// .collect(Collectors.toMap(EmisWaybill::getBillCode, Function.identity(), (a, b) -> a));
// // 过滤逻辑
// list = list.stream()
// .filter(wb -> {
// String virtualRemark = wb.getVirtualRemark();
// if (virtualRemark == null || virtualRemark.trim().isEmpty()) {
// return true;
// }
// String[] relatedNos = virtualRemark.split(",");
// for (String no : relatedNos) {
// EmisWaybill related = relatedMap.get(no.trim());
// if (related != null && Integer.valueOf(173).equals(related.getProblemType())) {
// return false;
// }
// }
// return true;
// })
// .collect(Collectors.toList());
return list;
}

View File

@ -46,16 +46,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="missType" column="miss_type"/>
<result property="virtualRemark" column="virtual_remark" />
<result property="problemType" column="problem_type" />
<result property="dispatchUnderlingSiteCode" column="dispatch_underling_site_code" />
<result property="dispatchUnderlingSiteName" column="dispatch_underling_site_name" />
</resultMap>
<sql id="selectEmisTmsSiteBatchMissVo">
select
m.id, m.bill_code, m.miss_reason, m.create_time, m.update_time, m.remark, m.del_flag,
m.line_code, m.product_type, m.start_site_code, m.next_site_code, m.supplier_code, m.start_date, m.end_date,m.miss_type,
w.send_site_code, s1.site_name as send_site_name,s2.site_name as start_site_name,s3.site_name as next_site_name, w.send_country, c1.name as send_country_name, w.destination_code, n.dest_name as destination_name,w.bl_is_question,
w.send_site_code, s1.site_name as send_site_name,s2.site_name as start_site_name,s3.site_name as next_site_name, w.send_country, c1.name as send_country_name, w.destination_code, n.dest_name as dispatch_underling_site_name,w.bl_is_question,
l.line_name as line_name,
w.receive_country, c2.name as receive_country_name, w.send_date, w.bl_sign, w.sign_date,
w.product_type,w.problem_type,w.virtual_remark,
w.product_type,w.problem_type,w.virtual_remark,w.dispatch_underling_site_code,
w.payment_type, w.parcel_qty, w.bill_weight, w.total_volume, w.volume_weight,
w.settlement_weight, w.freight, w.remark as waybill_remark, w.fee_remark, m.manager, k.trans_manager,
(SELECT GROUP_CONCAT(s.name)
@ -73,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join emis_site s3 on m.next_site_code=s3.site_code and s3.del_flag=0
left join emis_country c1 on w.send_country=c1.code and c1.del_flag='0'
left join emis_country c2 on w.receive_country=c2.code and c2.del_flag='0'
left join emis_destination n on w.destination_code=n.dest_code and n.del_flag='0'
left join emis_destination n on w.dispatch_underling_site_code=n.dest_code and n.del_flag='0'
left join emis_trans_line k on w.trans_line_type=k.line_code and k.del_flag='0'
left join emis_trans_plan_rule r on m.trans_plan_rule_id=r.id and r.del_flag='0'
left join emis_trans_line l on m.line_code=l.line_code and l.del_flag='0'
@ -139,7 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
w.trans_line_type as line_code, w.product_type, w.start_site_code, w.next_site_code,
null as supplier_code, null as start_date, null as end_date, '0' as miss_type,
w.send_site_code, s1.site_name as send_site_name,
w.send_country, c1.name as send_country_name, w.destination_code, n.dest_name as destination_name, w.bl_is_question,
w.send_country, c1.name as send_country_name, w.destination_code, n.dest_name as dispatch_underling_site_name, w.bl_is_question,
l.line_name as line_name,
w.receive_country, c2.name as receive_country_name, w.send_date, w.bl_sign, w.sign_date,
w.payment_type, w.parcel_qty, w.bill_weight, w.total_volume, w.volume_weight,
@ -160,7 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
inner join emis_waybill w on b.bill_code = w.bill_code and w.del_flag='0'
left join emis_site s1 on w.send_site_code=s1.site_code and s1.del_flag=0
left join emis_country c1 on w.send_country=c1.code and c1.del_flag=0
left join emis_destination n on w.destination_code=n.dest_code and n.del_flag=0
left join emis_destination n on w.dispatch_underling_site_code=n.dest_code and n.del_flag=0
left join emis_trans_line l on w.trans_line_type=l.line_code and l.del_flag=0
left join emis_country c2 on w.receive_country=c2.code and c2.del_flag=0
<where>

View File

@ -3825,6 +3825,7 @@
and DATE_FORMAT(a.send_date, '%Y-%m-%d') <![CDATA[ >= ]]> '2025-01-01'
and DATE_FORMAT(a.send_date, '%Y-%m-%d') <![CDATA[ <= ]]> DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 7 DAY), '%Y-%m-%d')
and (a.problem_type is null or a.problem_type not in (151,170))
and ((a.virtual_remark is null or a.virtual_remark = '' or a.virtual_remark = ' ')or a.receive_country != '0095')
and a.order_status not in ('0','2')
order by a.create_time desc
limit #{offset}, #{pageSize}