public boolean transUnpaid(GrProjectRule rule) {
WinProject pro = winProjectDao.get(rule.getProject().getId());
Project project = pro.getParent();
QParam q = new QParam<>();
q.q.put('projectId', project.getId());
q.q.put('day', 15);
q.q.put('mode', 1);
boolean warnFlag = false;
List<Map<String, Object>> bills = shipperBillDao.findList('fn/shipperBill.shipperNoPay', q.q);
if (!CollectionUtils.isEmpty(bills)) {
List nos = bills.stream().filter(item -> {
String no = item.get('no').toString();
long day = Long.parseLong(item.get('day').toString());
double amount = Double.parseDouble(item.get('amount').toString());
GrProjectWarnLatePay latePay = grProjectWarnLatePayDao.findOne(new CriteriaParam().eq('tdo.no', no).eq('status', LatePayStatusE.正常));
return latePay == null || day > latePay.getDays() + 15 || amount >= 10000;
}).map(item -> item.get('no').toString()).distinct().collect(Collectors.toList());
if (nos.toString().length() <= 2) {
return false;
}
String content = '以下运单' + nos + ',货主拖延支付用户运费超过15天以上或者金额超过1万元且已超过逾期控制!';
this.createGrWarnRecord(rule.getType(), pro, content, null);
//发送短信。未支付的运单过多时,只取前5个
if (nos.size() <= 5) {
this.sendWarnMessage(pro.getParent().getName(), content);
} else {
String fiveNos = '';
for (int i = 0; i < 5; i++) {
if (''.equals(fiveNos)) {
fiveNos = nos.get(i);
} else {
fiveNos = fiveNos + ',' + nos.get(i);
}
}
content = '以下运单' + fiveNos + ',货主拖延支付用户运费超过15天以上或者金额超过1万元!';
this.sendWarnMessage(pro.getParent().getName(), content);
}
warnFlag = true;
}
return warnFlag;
}