|
@@ -9,7 +9,10 @@ import kd.bos.orm.query.QFilter;
|
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Tyx 费用报销单+付款单校验器
|
|
* Tyx 费用报销单+付款单校验器
|
|
@@ -28,8 +31,9 @@ public class DailyReimBurseBillValidator extends AbstractValidator {
|
|
|
String msg = "申请日期所在期间已关账,不允许" + this.getOperationName();
|
|
String msg = "申请日期所在期间已关账,不允许" + this.getOperationName();
|
|
|
this.addErrorMessage(dataEntity, msg);
|
|
this.addErrorMessage(dataEntity, msg);
|
|
|
}
|
|
}
|
|
|
- if (!checkSupplier(bill)) {
|
|
|
|
|
- String msg = "费用明细的供应商和车牌号与关联申请单不一致,不允许" + this.getOperationName();
|
|
|
|
|
|
|
+ String operateType = this.getOperateType();
|
|
|
|
|
+ if ("submit".equals(operateType) && !checkSupplier(bill)) {
|
|
|
|
|
+ String msg = "费用明细的供应商或车牌号与关联申请单不一致,不允许" + this.getOperationName();
|
|
|
this.addErrorMessage(dataEntity, msg);
|
|
this.addErrorMessage(dataEntity, msg);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -59,6 +63,17 @@ public class DailyReimBurseBillValidator extends AbstractValidator {
|
|
|
DynamicObjectCollection expenseentryentity = bill.getDynamicObjectCollection("expenseentryentity");
|
|
DynamicObjectCollection expenseentryentity = bill.getDynamicObjectCollection("expenseentryentity");
|
|
|
// 关联申请
|
|
// 关联申请
|
|
|
DynamicObjectCollection writeoffapply = bill.getDynamicObjectCollection("writeoffapply");
|
|
DynamicObjectCollection writeoffapply = bill.getDynamicObjectCollection("writeoffapply");
|
|
|
|
|
+ List<String> plateNoList = new ArrayList<>();
|
|
|
|
|
+ List<Long> supplierList = new ArrayList<>();
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(writeoffapply)) {
|
|
|
|
|
+ List<String> billno = writeoffapply.stream().map(e -> e.getString("applybillno")).collect(Collectors.toList());
|
|
|
|
|
+ QFilter qFilter = new QFilter("billno", QCP.in, billno);
|
|
|
|
|
+ DynamicObjectCollection query = QueryServiceHelper.query("er_dailyapplybill", "expenseentryentity,expenseentryentity.nckd_supplier,expenseentryentity.nckd_plateno", qFilter.toArray());
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(query)) {
|
|
|
|
|
+ plateNoList = query.stream().map(e -> e.getString("expenseentryentity.nckd_plateno")).collect(Collectors.toList());
|
|
|
|
|
+ supplierList = query.stream().map(e -> e.getLong("expenseentryentity.nckd_supplier")).collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
for (DynamicObject dynamicObject : expenseentryentity) {
|
|
for (DynamicObject dynamicObject : expenseentryentity) {
|
|
|
DynamicObject expenseitem = dynamicObject.getDynamicObject("expenseitem");
|
|
DynamicObject expenseitem = dynamicObject.getDynamicObject("expenseitem");
|
|
@@ -66,18 +81,13 @@ public class DailyReimBurseBillValidator extends AbstractValidator {
|
|
|
if (ObjectUtils.isEmpty(writeoffapply)) {
|
|
if (ObjectUtils.isEmpty(writeoffapply)) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- for (DynamicObject apply : writeoffapply) {
|
|
|
|
|
- // 供应商
|
|
|
|
|
- DynamicObject nckdApplysupplier = apply.getDynamicObject("nckd_applysupplier");
|
|
|
|
|
- DynamicObject nckdSupplier = dynamicObject.getDynamicObject("nckd_supplier");
|
|
|
|
|
- // 车牌号
|
|
|
|
|
- String applyPlateNo = apply.getString("nckd_plateno");
|
|
|
|
|
- String plateNo = dynamicObject.getString("nckd_textfield");
|
|
|
|
|
- if (nckdApplysupplier != null && nckdSupplier != null
|
|
|
|
|
- && applyPlateNo != null && plateNo != null) {
|
|
|
|
|
- if (nckdApplysupplier.getLong("id") == nckdSupplier.getLong("id") && applyPlateNo.equals(plateNo)) {
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 供应商
|
|
|
|
|
+ DynamicObject nckdSupplier = dynamicObject.getDynamicObject("nckd_supplier");
|
|
|
|
|
+ // 车牌号
|
|
|
|
|
+ String plateNo = dynamicObject.getString("nckd_plateno");
|
|
|
|
|
+ if (nckdSupplier != null && plateNo != null) {
|
|
|
|
|
+ if (supplierList.contains(nckdSupplier.getLong("id")) && plateNoList.contains(plateNo)) {
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|