科目分类通用插件优化
This commit is contained in:
parent
f05be78785
commit
f477b3ff90
|
@ -150,8 +150,11 @@ public class ReimbursementAccountTypePlugin extends AbstractBillPlugIn implement
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DynamicObject costDept = (DynamicObject) this.getModel().getValue("costdept");//费用承担部门
|
DynamicObject costDept = (DynamicObject) this.getModel().getValue("costdept");//费用承担部门
|
||||||
long userid = Long.parseLong(RequestContext.get().getUserId());//当前用户id
|
// long userid = Long.parseLong(RequestContext.get().getUserId());//当前用户id
|
||||||
String userMainJob = UserServiceHelper.getUserMainJob(userid);//获取用户默认主职位
|
// String userMainJob = UserServiceHelper.getUserMainJob(userid);//获取用户默认主职位
|
||||||
|
DynamicObject applier = (DynamicObject) this.getModel().getValue("applier");//申请人
|
||||||
|
long applierId = applier.getLong("id");//申请人id
|
||||||
|
String userMainJob = UserServiceHelper.getUserMainJob(applierId);//申请人默认主职位
|
||||||
ChangeData changeData = e.getChangeSet()[0];
|
ChangeData changeData = e.getChangeSet()[0];
|
||||||
int rowIndex = changeData.getRowIndex();//所选行
|
int rowIndex = changeData.getRowIndex();//所选行
|
||||||
DynamicObjectCollection entryEntityCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("expenseentryentity");//分录
|
DynamicObjectCollection entryEntityCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("expenseentryentity");//分录
|
||||||
|
@ -216,36 +219,40 @@ public class ReimbursementAccountTypePlugin extends AbstractBillPlugIn implement
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case "职位":
|
case "职位":
|
||||||
DynamicObject zcgj_positiontype = entryRule.getDynamicObject("zcgj_positiontype");//职位默认分类
|
QFilter filter4 = new QFilter("zcgj_entryposition.zcgj_cusposition.name", QCP.equals, userMainJob);//职位
|
||||||
if (zcgj_positiontype != null) {
|
QFilter filter5 = new QFilter("zcgj_entryposition.zcgj_expenseitem", QCP.equals, expenseItemId);//费用项目
|
||||||
QFilter filter4 = new QFilter("zcgj_entryposition.zcgj_cusposition.name", QCP.equals, userMainJob);
|
DynamicObjectCollection zcgj_positionrule = QueryServiceHelper.query("zcgj_positionrule",
|
||||||
DynamicObjectCollection zcgj_positionrule = QueryServiceHelper.query("zcgj_positionrule",
|
"zcgj_entryposition.zcgj_accounttype", new QFilter[]{filter4, filter5});//职位科目分类单
|
||||||
"zcgj_entryposition.zcgj_accounttype", new QFilter[]{filter4});//职位科目分类单
|
if (zcgj_positionrule != null && zcgj_positionrule.size() == 1) {
|
||||||
if (zcgj_positionrule != null && zcgj_positionrule.size() == 1) {
|
long zcgj_accounttype = zcgj_positionrule.get(0).getLong("zcgj_entryposition.zcgj_accounttype");
|
||||||
long zcgj_accounttype = zcgj_positionrule.get(0).getLong("zcgj_entryposition.zcgj_accounttype");
|
if (zcgj_accounttype != 0) {
|
||||||
this.getModel().setValue("zcgj_accounttype", zcgj_accounttype, rowIndex);//科目属性
|
this.getModel().setValue("zcgj_accounttype", zcgj_accounttype, rowIndex);//科目属性
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
this.getModel().setValue("zcgj_accounttype", zcgj_positiontype, rowIndex);//科目属性
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DynamicObject zcgj_positiontype = entryRule.getDynamicObject("zcgj_positiontype");//职位默认分类
|
||||||
|
if (zcgj_positiontype != null) {
|
||||||
|
this.getModel().setValue("zcgj_accounttype", zcgj_positiontype, rowIndex);//科目属性
|
||||||
|
return;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "人员":
|
case "人员":
|
||||||
DynamicObject zcgj_persontype = entryRule.getDynamicObject("zcgj_persontype");//人员默认分类
|
QFilter filter6 = new QFilter("zcgj_entryperson.zcgj_person.id", QCP.equals, applierId);//申请人
|
||||||
if (zcgj_persontype != null) {
|
QFilter filter7 = new QFilter("zcgj_entryperson.zcgj_expenseitem", QCP.equals, expenseItemId);//费用项目
|
||||||
QFilter filter5 = new QFilter("zcgj_entryperson.zcgj_person.id", QCP.equals, userid);
|
DynamicObjectCollection zcgj_personrule = QueryServiceHelper.query("zcgj_personrule",
|
||||||
DynamicObjectCollection zcgj_positionrule = QueryServiceHelper.query("zcgj_personrule",
|
"zcgj_entryperson.zcgj_accounttype", new QFilter[]{filter6, filter7});//人员科目分类单
|
||||||
"zcgj_entryperson.zcgj_accounttype", new QFilter[]{filter5});//人员科目分类单
|
if (zcgj_personrule != null && zcgj_personrule.size() == 1) {
|
||||||
if (zcgj_positionrule != null && zcgj_positionrule.size() == 1) {
|
long zcgj_accounttype = zcgj_personrule.get(0).getLong("zcgj_entryperson.zcgj_accounttype");
|
||||||
long zcgj_accounttype = zcgj_positionrule.get(0).getLong("zcgj_entryperson.zcgj_accounttype");
|
if (zcgj_accounttype != 0) {
|
||||||
this.getModel().setValue("zcgj_accounttype", zcgj_accounttype, rowIndex);//科目属性
|
this.getModel().setValue("zcgj_accounttype", zcgj_accounttype, rowIndex);//科目属性
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
this.getModel().setValue("zcgj_accounttype", zcgj_persontype, rowIndex);//科目属性
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DynamicObject zcgj_persontype = entryRule.getDynamicObject("zcgj_persontype");//人员默认分类
|
||||||
|
if (zcgj_persontype != null) {
|
||||||
|
this.getModel().setValue("zcgj_accounttype", zcgj_persontype, rowIndex);//科目属性
|
||||||
|
return;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue