增加订单复选搜索
This commit is contained in:
+50
-7
@@ -3415,7 +3415,7 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
}
|
||||
PrcPriceSetVersion effect = null;
|
||||
PrcPriceSetVersion pending = null;
|
||||
PrcPriceSetVersion best = null;
|
||||
List<PrcPriceSetVersion> ranked = new ArrayList<PrcPriceSetVersion>();
|
||||
for (PrcPriceSetVersion v : list)
|
||||
{
|
||||
if (v == null || v.getPsvId() == null)
|
||||
@@ -3434,15 +3434,58 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
{
|
||||
pending = v;
|
||||
}
|
||||
if (best == null || (v.getVersionSeq() != null && best.getVersionSeq() != null
|
||||
&& v.getVersionSeq().intValue() > best.getVersionSeq().intValue())
|
||||
|| (best.getVersionSeq() == null && v.getVersionSeq() != null))
|
||||
}
|
||||
if (effect != null)
|
||||
{
|
||||
ranked.add(effect);
|
||||
}
|
||||
if (pending != null && (effect == null || !pending.getPsvId().equals(effect.getPsvId())))
|
||||
{
|
||||
ranked.add(pending);
|
||||
}
|
||||
list.stream()
|
||||
.filter(v -> v != null && v.getPsvId() != null)
|
||||
.filter(v -> excludePsvId == null || !excludePsvId.equals(v.getPsvId()))
|
||||
.sorted((a, b) -> {
|
||||
int sa = a.getVersionSeq() == null ? 0 : a.getVersionSeq().intValue();
|
||||
int sb = b.getVersionSeq() == null ? 0 : b.getVersionSeq().intValue();
|
||||
return Integer.compare(sb, sa);
|
||||
})
|
||||
.forEach(v -> {
|
||||
boolean exists = false;
|
||||
for (PrcPriceSetVersion r : ranked)
|
||||
{
|
||||
if (r.getPsvId().equals(v.getPsvId()))
|
||||
{
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!exists)
|
||||
{
|
||||
ranked.add(v);
|
||||
}
|
||||
});
|
||||
for (PrcPriceSetVersion cand : ranked)
|
||||
{
|
||||
if (versionHasSetProducts(cand.getPsvId()))
|
||||
{
|
||||
best = v;
|
||||
return cand.getPsvId();
|
||||
}
|
||||
}
|
||||
PrcPriceSetVersion pick = effect != null ? effect : (pending != null ? pending : best);
|
||||
return pick == null ? null : pick.getPsvId();
|
||||
return ranked.isEmpty() ? null : ranked.get(0).getPsvId();
|
||||
}
|
||||
|
||||
private boolean versionHasSetProducts(Long psvId)
|
||||
{
|
||||
if (psvId == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
PrcPriceSetProduct pq = new PrcPriceSetProduct();
|
||||
pq.setPsvId(psvId);
|
||||
List<PrcPriceSetProduct> products = setProductMapper.selectPrcPriceSetProductList(pq);
|
||||
return products != null && !products.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user