|
@@ -8,13 +8,15 @@ import kd.bos.orm.query.QCP;
|
|
|
import kd.bos.orm.query.QFilter;
|
|
import kd.bos.orm.query.QFilter;
|
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
|
|
|
import java.util.Calendar;
|
|
import java.util.Calendar;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Tyx 费用报销单+付款单校验器
|
|
* Tyx 费用报销单+付款单校验器
|
|
@@ -33,6 +35,11 @@ public class DailyReimBurseBillValidator extends AbstractValidator {
|
|
|
String msg = "申请日期所在期间已关账,不允许" + this.getOperationName();
|
|
String msg = "申请日期所在期间已关账,不允许" + this.getOperationName();
|
|
|
this.addErrorMessage(dataEntity, msg);
|
|
this.addErrorMessage(dataEntity, msg);
|
|
|
}
|
|
}
|
|
|
|
|
+ String operateType = this.getOperateType();
|
|
|
|
|
+ if ("submit".equals(operateType) && !checkSupplier(bill)) {
|
|
|
|
|
+ String msg = "费用明细的供应商或车牌号与关联申请单不一致,不允许" + this.getOperationName();
|
|
|
|
|
+ this.addErrorMessage(dataEntity, msg);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
//判断申请单发生日期与本单发生日期是否一致
|
|
//判断申请单发生日期与本单发生日期是否一致
|
|
|
checkDateDiff(dataEntity, bill);
|
|
checkDateDiff(dataEntity, bill);
|
|
@@ -137,4 +144,48 @@ public class DailyReimBurseBillValidator extends AbstractValidator {
|
|
|
|
|
|
|
|
return QueryServiceHelper.exists(PERIODCONTROL_ENTITY, new QFilter[]{filter});
|
|
return QueryServiceHelper.exists(PERIODCONTROL_ENTITY, new QFilter[]{filter});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 校验供应商和车牌号
|
|
|
|
|
+ * @param bill
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public boolean checkSupplier(DynamicObject bill) {
|
|
|
|
|
+ // 费用明细
|
|
|
|
|
+ DynamicObjectCollection expenseentryentity = bill.getDynamicObjectCollection("expenseentryentity");
|
|
|
|
|
+ // 关联申请
|
|
|
|
|
+ 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) {
|
|
|
|
|
+ DynamicObject expenseitem = dynamicObject.getDynamicObject("expenseitem");
|
|
|
|
|
+ if (expenseitem != null && "FY00202".equals(expenseitem.getString("number"))) {
|
|
|
|
|
+ if (ObjectUtils.isEmpty(writeoffapply)) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 供应商
|
|
|
|
|
+ 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 true;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|