demand: 新增组批次成功运单过滤重复运单,查询漏组批次运单过滤出口虚拟单的主单
committer: heyu
This commit is contained in:
parent
a620e879e5
commit
07781bd360
@ -126,4 +126,6 @@ public class EmisTmsSiteBatchMiss extends BaseEntity {
|
||||
|
||||
/* 是否问题件 1-是 0-否 */
|
||||
private String blIsQuestion;
|
||||
private String virtualRemark;
|
||||
private Integer problemType;
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xdadan.erp.emis.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisTmsSiteBatchMiss;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
@ -87,4 +88,9 @@ public interface EmisTmsSiteBatchMissMapper {
|
||||
void deleteByBillCodes(@Param("billCodes") List<String> billCodes);
|
||||
|
||||
void deleteReally(String lineCode);
|
||||
|
||||
/**
|
||||
* 根据运单号批量查询TMS漏组批次信息
|
||||
*/
|
||||
List<EmisWaybill> selectByBillCodes(@Param("billCodes") List<String> billCodes);
|
||||
}
|
||||
@ -73,16 +73,54 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
||||
log.info("Selecting TMS site batch miss list with params: {}", emisTmsSiteBatchMiss);
|
||||
List<EmisTmsSiteBatchMiss> list = null;
|
||||
// 如果单号不为空,则去除其他参数
|
||||
if(!StringUtils.isEmpty(emisTmsSiteBatchMiss.getBillCode())){
|
||||
if (!StringUtils.isEmpty(emisTmsSiteBatchMiss.getBillCode())) {
|
||||
emisTmsSiteBatchMiss.setBillCode(WaybillHelper.formatQueryValue(emisTmsSiteBatchMiss.getBillCode()));
|
||||
String[] billCodeSortList = emisTmsSiteBatchMiss.getBillCode().split(",");
|
||||
if(billCodeSortList.length>1){
|
||||
emisTmsSiteBatchMiss.getParams().put("billCodeSortList",Arrays.asList(billCodeSortList));
|
||||
if (billCodeSortList.length > 1) {
|
||||
emisTmsSiteBatchMiss.getParams().put("billCodeSortList", Arrays.asList(billCodeSortList));
|
||||
}
|
||||
list = emisTmsSiteBatchMissMapper.selectEmisTmsSiteBatchMissList(emisTmsSiteBatchMiss);
|
||||
}else{
|
||||
} else {
|
||||
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());
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -190,7 +228,7 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
||||
try {
|
||||
List<EmisWaybill> waybills = future.get();
|
||||
allWaybills.addAll(waybills);
|
||||
// totalProcessed += waybills.size();
|
||||
totalProcessed += waybills.size();
|
||||
} catch (Exception e) {
|
||||
log.error("Error getting waybill results", e);
|
||||
}
|
||||
@ -199,34 +237,35 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
||||
// 关闭线程池
|
||||
executorService.shutdown();
|
||||
|
||||
// 构建运单号到EmisWaybill的映射
|
||||
Map<String, EmisWaybill> waybillMap = allWaybills.stream()
|
||||
.collect(Collectors.toMap(EmisWaybill::getBillCode, Function.identity(), (a, b) -> a));
|
||||
|
||||
allWaybills = allWaybills.stream()
|
||||
.filter(wb -> {
|
||||
String virtualRemark = wb.getVirtualRemark();
|
||||
if (StringUtils.isBlank(virtualRemark)) {
|
||||
return true;
|
||||
}
|
||||
// 解析virtualRemark中的运单号
|
||||
String[] relatedNos = virtualRemark.split(",");
|
||||
for (String no : relatedNos) {
|
||||
EmisWaybill related = waybillMap.get(no.trim());
|
||||
if (related != null && Objects.equals(related.getProblemType(), 173)) {
|
||||
return false; // 只要有一个关联运单problemType=173,则过滤掉
|
||||
}
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
allWaybills = allWaybills.stream()
|
||||
.filter(wb -> !Objects.equals(wb.getProblemType(), 170))
|
||||
.filter(wb -> !Objects.equals(wb.getSiteBatchStatus(), "1"))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
totalProcessed = allWaybills.size();
|
||||
// // 构建运单号到EmisWaybill的映射
|
||||
// Map<String, EmisWaybill> waybillMap = allWaybills.stream()
|
||||
// .collect(Collectors.toMap(EmisWaybill::getBillCode, Function.identity(), (a,
|
||||
// b) -> a));
|
||||
//
|
||||
// allWaybills = allWaybills.stream()
|
||||
// .filter(wb -> {
|
||||
// String virtualRemark = wb.getVirtualRemark();
|
||||
// if (StringUtils.isBlank(virtualRemark)) {
|
||||
// return true;
|
||||
// }
|
||||
// // 解析virtualRemark中的运单号
|
||||
// String[] relatedNos = virtualRemark.split(",");
|
||||
// for (String no : relatedNos) {
|
||||
// EmisWaybill related = waybillMap.get(no.trim());
|
||||
// if (related != null && Objects.equals(related.getProblemType(), 173)) {
|
||||
// return false; // 只要有一个关联运单problemType=173,则过滤掉
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// })
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// allWaybills = allWaybills.stream()
|
||||
// .filter(wb -> !Objects.equals(wb.getProblemType(), 170))
|
||||
//// .filter(wb -> !Objects.equals(wb.getSiteBatchStatus(), "1"))
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// totalProcessed = allWaybills.size();
|
||||
|
||||
// 按1000条数据分组处理
|
||||
List<List<EmisWaybill>> batches = new ArrayList<>();
|
||||
|
||||
@ -44,16 +44,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="waybillRemark" column="waybill_remark"/>
|
||||
<result property="feeRemark" column="fee_remark"/>
|
||||
<result property="missType" column="miss_type"/>
|
||||
<result property="virtualRemark" column="virtual_remark" />
|
||||
<result property="problemType" column="problem_type" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisTmsSiteBatchMissVo">
|
||||
select
|
||||
m.id, m.bill_code, m.miss_reason, m.create_by, m.create_time, m.update_by, m.update_time, m.remark, m.del_flag,
|
||||
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,
|
||||
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.product_type,w.problem_type,w.virtual_remark,
|
||||
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)
|
||||
@ -414,4 +416,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
HAVING COUNT(*) = #{count}
|
||||
)
|
||||
</select>
|
||||
<select id="selectByBillCodes" resultMap="com.xdadan.erp.emis.mapper.EmisWaybillMapper.EmisWaybillResult">
|
||||
select a.id, a.bill_code,a.trans_line_type,
|
||||
a.product_type,a.start_site_code,a.send_site_code,a.problem_type,a.virtual_remark
|
||||
from emis_waybill a
|
||||
where bill_code in
|
||||
<foreach collection="billCodes" item="billCode" open="(" separator="," close=")">
|
||||
#{billCode}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@ -3814,17 +3814,17 @@
|
||||
|
||||
<select id="selectWaybillListBySiteBatchStatus" resultMap="EmisWaybillResult">
|
||||
select a.id, a.bill_code,a.trans_line_type,
|
||||
a.product_type,a.start_site_code,a.send_site_code,a.problem_type,a.virtual_remark,b.site_batch_status
|
||||
a.product_type,a.start_site_code,a.send_site_code,a.problem_type,a.virtual_remark
|
||||
from emis_waybill a
|
||||
left join emis_waybill_batch_status b on a.bill_code = b.bill_code
|
||||
and (b.site_batch_status is null or b.site_batch_status != '1')
|
||||
where a.del_flag = '0'
|
||||
-- and (b.site_batch_status is null or b.site_batch_status != '1')
|
||||
<if test="lineCode != null and lineCode != ''">
|
||||
and a.trans_line_type = #{lineCode}
|
||||
</if>
|
||||
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 != 151)
|
||||
and (a.problem_type is null or a.problem_type not in (151,170))
|
||||
and a.order_status not in ('0','2')
|
||||
order by a.create_time desc
|
||||
limit #{offset}, #{pageSize}
|
||||
|
||||
@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</sql>
|
||||
|
||||
<insert id="batchInsertEmisWaybillBatchStatus" parameterType="java.util.List">
|
||||
insert into emis_waybill_batch_status (
|
||||
insert ignore into emis_waybill_batch_status (
|
||||
bill_code, site_batch_status, remark,
|
||||
create_by, create_time, update_by, update_time
|
||||
) values
|
||||
|
||||
Loading…
Reference in New Issue
Block a user