|
@@ -0,0 +1,54 @@
|
|
|
+package nckd.jimin.jyyy.fi.plugin.form;
|
|
|
+
|
|
|
+import kd.bos.bill.AbstractBillPlugIn;
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
+import kd.bos.orm.query.QCP;
|
|
|
+import kd.bos.orm.query.QFilter;
|
|
|
+import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
+
|
|
|
+import java.util.EventObject;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 外办申请单扩展插件
|
|
|
+ */
|
|
|
+public class ErDailyVehicleBillEdit extends AbstractBillPlugIn {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterCreateNewData(EventObject e) {
|
|
|
+ super.afterCreateNewData(e);
|
|
|
+ initVehiclecity();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 外办城市默认赋值
|
|
|
+ */
|
|
|
+ protected void initVehiclecity(){
|
|
|
+ // 申请人 -> HR人员 -> 常驻工作地 -> 工作地
|
|
|
+ DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
|
|
+ DynamicObject applier = dataEntity.getDynamicObject("applier");
|
|
|
+ if(applier == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ DynamicObject hrPerson = QueryServiceHelper.queryOne("hrpi_person", "id", new QFilter[]{
|
|
|
+ new QFilter("number", QCP.equals, applier.getString("number")),
|
|
|
+ new QFilter("iscurrentversion", QCP.equals, Boolean.TRUE)
|
|
|
+ });
|
|
|
+
|
|
|
+ if(hrPerson == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ DynamicObject baseLocation = QueryServiceHelper.queryOne("hrpi_baselocation", "location.city.id", new QFilter[]{
|
|
|
+ new QFilter("person", QCP.equals, hrPerson.getLong("id")),
|
|
|
+ new QFilter("iscurrentversion", QCP.equals, Boolean.TRUE)
|
|
|
+ });
|
|
|
+
|
|
|
+ if(baseLocation == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ long cityId = baseLocation.getLong("location.city.id");
|
|
|
+ if(cityId != 0L){
|
|
|
+ getModel().setItemValueByID("vehiclecity",cityId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|