付款申请单移除所属部门过滤和默认功能
This commit is contained in:
parent
c48de98b79
commit
92a166b316
|
@ -6,10 +6,17 @@ import kd.bos.bill.OperationStatus;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.entity.datamodel.events.ChangeData;
|
import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
import kd.bos.permission.api.HasPermOrgResult;
|
||||||
|
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
|
||||||
|
import kd.bos.servicehelper.permission.PermissionServiceHelper;
|
||||||
import kd.bos.servicehelper.user.UserServiceHelper;
|
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1:付款申请单通用插件
|
* 1:付款申请单通用插件
|
||||||
|
@ -23,11 +30,24 @@ public class PaymentapplyGeneralPlugin extends AbstractBillPlugIn implements Plu
|
||||||
BillShowParameter bsp=(BillShowParameter)this.getView().getFormShowParameter();
|
BillShowParameter bsp=(BillShowParameter)this.getView().getFormShowParameter();
|
||||||
if(bsp.getStatus()== OperationStatus.ADDNEW ){
|
if(bsp.getStatus()== OperationStatus.ADDNEW ){
|
||||||
DynamicObject person = this.getModel().getDataEntity().getDynamicObject("person");
|
DynamicObject person = this.getModel().getDataEntity().getDynamicObject("person");
|
||||||
if(person!=null){
|
/*if(person!=null){
|
||||||
long mainOrgId = UserServiceHelper.getUserMainOrgId(person.getLong("id"));
|
long mainOrgId = UserServiceHelper.getUserMainOrgId(person.getLong("id"));
|
||||||
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
List<Long> orgsUserJoin = UserServiceHelper.getOrgsUserJoin(person.getLong("id"));
|
||||||
this.getView().updateView("zcgj_persondepart");
|
DynamicObject org = (DynamicObject) this.getModel().getValue("fiaccountorg");
|
||||||
}
|
if(org!=null && orgsUserJoin!=null && !orgsUserJoin.isEmpty()){
|
||||||
|
Set<Long> collect = new HashSet<>(orgsUserJoin);
|
||||||
|
if(collect.contains(org.getLong("id"))){
|
||||||
|
this.getModel().setValue("zcgj_persondepart", org.getLong("id"));
|
||||||
|
this.getView().updateView("zcgj_persondepart");
|
||||||
|
}else{
|
||||||
|
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||||
|
this.getView().updateView("zcgj_persondepart");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||||
|
this.getView().updateView("zcgj_persondepart");
|
||||||
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,19 +55,63 @@ public class PaymentapplyGeneralPlugin extends AbstractBillPlugIn implements Plu
|
||||||
public void propertyChanged(PropertyChangedArgs e) {
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
super.propertyChanged(e);
|
super.propertyChanged(e);
|
||||||
String name = e.getProperty().getName();
|
String name = e.getProperty().getName();
|
||||||
if("person".equals(name)){
|
/*if("person".equals(name)){
|
||||||
ChangeData changeData = e.getChangeSet()[0];//获取改变的数据
|
ChangeData changeData = e.getChangeSet()[0];//获取改变的数据
|
||||||
DynamicObject oldValue = (DynamicObject) changeData.getOldValue();
|
DynamicObject oldValue = (DynamicObject) changeData.getOldValue();
|
||||||
DynamicObject newValue = (DynamicObject) changeData.getNewValue();
|
DynamicObject newValue = (DynamicObject) changeData.getNewValue();
|
||||||
if(newValue !=null){
|
if(newValue !=null){
|
||||||
long userid = newValue.getLong("id");
|
long userid = newValue.getLong("id");
|
||||||
long mainOrgId = UserServiceHelper.getUserMainOrgId(userid);
|
long mainOrgId = UserServiceHelper.getUserMainOrgId(userid);
|
||||||
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
List<Long> orgsUserJoin = UserServiceHelper.getOrgsUserJoin(userid);
|
||||||
this.getView().updateView("zcgj_persondepart");
|
DynamicObject org = (DynamicObject) this.getModel().getValue("fiaccountorg");
|
||||||
|
if(org!=null && orgsUserJoin!=null && !orgsUserJoin.isEmpty()){
|
||||||
|
Set<Long> collect = new HashSet<>(orgsUserJoin);
|
||||||
|
if(collect.contains(org.getLong("id"))){
|
||||||
|
this.getModel().setValue("zcgj_persondepart", org.getLong("id"));
|
||||||
|
this.getView().updateView("zcgj_persondepart");
|
||||||
|
}else{
|
||||||
|
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||||
|
this.getView().updateView("zcgj_persondepart");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||||
|
this.getView().updateView("zcgj_persondepart");
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
this.getView().showErrorNotification("申请人不能为空");
|
this.getView().showErrorNotification("申请人不能为空");
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
/*else if("fiaccountorg".equals(name)){
|
||||||
|
ChangeData changeData = e.getChangeSet()[0];//获取改变的数据
|
||||||
|
DynamicObject oldValue = (DynamicObject) changeData.getOldValue();
|
||||||
|
DynamicObject newValue = (DynamicObject) changeData.getNewValue();
|
||||||
|
if(newValue !=null){
|
||||||
|
DynamicObject person = this.getModel().getDataEntity().getDynamicObject("person");
|
||||||
|
long userid = person.getLong("id");
|
||||||
|
long mainOrgId = UserServiceHelper.getUserMainOrgId(userid);
|
||||||
|
List<Long> orgsUserJoin = UserServiceHelper.getOrgsUserJoin(userid);
|
||||||
|
List<Long> allDepartment = UserServiceHelper.getAllDepartmentByUserId(userid);
|
||||||
|
HasPermOrgResult userHasPermOrgs = PermissionServiceHelper.getUserHasPermOrgs(userid,false);
|
||||||
|
List<Long> hasPermOrgs = userHasPermOrgs.getHasPermOrgs();
|
||||||
|
List<Long> userDepartment = UserServiceHelper.getUserDepartment(userid, false);
|
||||||
|
if(hasPermOrgs!=null && !hasPermOrgs.isEmpty()){
|
||||||
|
Set<Long> collect = new HashSet<>(hasPermOrgs);
|
||||||
|
if(collect.contains(newValue.getLong("id"))){
|
||||||
|
this.getModel().setValue("zcgj_persondepart", newValue.getLong("id"));
|
||||||
|
this.getView().updateView("zcgj_persondepart");
|
||||||
|
}else{
|
||||||
|
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||||
|
this.getView().updateView("zcgj_persondepart");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||||
|
this.getView().updateView("zcgj_persondepart");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
this.getView().showErrorNotification("所属组织不能为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue