差旅报销单汽车飞机发票乘车人校验
This commit is contained in:
parent
912cf2b8ef
commit
cf1566aa79
|
@ -0,0 +1,85 @@
|
||||||
|
package zcgj.zcdev.zcdev.fs.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.algo.DataSet;
|
||||||
|
import kd.bos.algo.Row;
|
||||||
|
import kd.bos.context.RequestContext;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.ExtendedDataEntity;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||||
|
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||||
|
import kd.bos.entity.validate.AbstractValidator;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.QueryServiceHelper;
|
||||||
|
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||||
|
import kd.bos.util.StringUtils;
|
||||||
|
import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.Month;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.temporal.TemporalAdjusters;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 差旅报销单汽车、飞机发票乘车人和申请人校验
|
||||||
|
*/
|
||||||
|
public class TripreimbursebillIsInvoiceUserCheckOp extends AbstractOperationServicePlugIn {
|
||||||
|
private static final String prefix ="zcgj";
|
||||||
|
@Override
|
||||||
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||||
|
super.onPreparePropertys(e);
|
||||||
|
e.getFieldKeys().add("applier");
|
||||||
|
e.getFieldKeys().add("invoiceentry");
|
||||||
|
e.getFieldKeys().add("costcompany");//费用承担公司
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||||
|
super.onAddValidators(e);
|
||||||
|
e.getValidators().add(new ValidatorExt());
|
||||||
|
}
|
||||||
|
|
||||||
|
class ValidatorExt extends AbstractValidator {
|
||||||
|
@Override
|
||||||
|
public void validate() {
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
|
||||||
|
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
|
||||||
|
Map<Long,Map<String,Object>> allMap = new HashMap<>();
|
||||||
|
//当前提交的探亲单据id集合
|
||||||
|
Map<Long,List<Long>> currentBillIdListMap = new HashMap<>();
|
||||||
|
|
||||||
|
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||||
|
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
|
||||||
|
DynamicObject costCompany = dataEntity.getDynamicObject("costcompany");//费用承担公司
|
||||||
|
if (costCompany != null) {
|
||||||
|
Long companyId = costCompany.getLong("id");
|
||||||
|
if (OrgCheckUtils.isKS(companyId)) {
|
||||||
|
//获取报销人
|
||||||
|
DynamicObject applier = dataEntity.getDynamicObject("applier");
|
||||||
|
String applierName = applier.getString("name");
|
||||||
|
DynamicObjectCollection tripentry = dataEntity.getDynamicObjectCollection("invoiceentry");//oa流程分录
|
||||||
|
int i=1;
|
||||||
|
for (DynamicObject dynamicObject : tripentry) {
|
||||||
|
String invoicetype = dynamicObject.getString("invoicetype");
|
||||||
|
if("9".equals(invoicetype) || "10".equals(invoicetype)){
|
||||||
|
String passengername = dynamicObject.getString("passengername");
|
||||||
|
if(!applierName.equals(passengername)){
|
||||||
|
String message = String.format("发票信息第%d行,旅客和申请人不一致!",i);
|
||||||
|
this.addFatalErrorMessage(extendedDataEntity, message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue