付款申请单移除所属部门过滤和默认功能
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.entity.datamodel.events.ChangeData;
 | 
			
		||||
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.sdk.plugin.Plugin;
 | 
			
		||||
 | 
			
		||||
import java.util.EventObject;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 1:付款申请单通用插件
 | 
			
		||||
| 
						 | 
				
			
			@ -23,11 +30,24 @@ public class PaymentapplyGeneralPlugin extends AbstractBillPlugIn implements Plu
 | 
			
		|||
        BillShowParameter bsp=(BillShowParameter)this.getView().getFormShowParameter();
 | 
			
		||||
        if(bsp.getStatus()== OperationStatus.ADDNEW ){
 | 
			
		||||
            DynamicObject person = this.getModel().getDataEntity().getDynamicObject("person");
 | 
			
		||||
            if(person!=null){
 | 
			
		||||
            /*if(person!=null){
 | 
			
		||||
                long mainOrgId = UserServiceHelper.getUserMainOrgId(person.getLong("id"));
 | 
			
		||||
                this.getModel().setValue("zcgj_persondepart", mainOrgId);
 | 
			
		||||
                this.getView().updateView("zcgj_persondepart");
 | 
			
		||||
            }
 | 
			
		||||
                List<Long> orgsUserJoin = UserServiceHelper.getOrgsUserJoin(person.getLong("id"));
 | 
			
		||||
                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) {
 | 
			
		||||
        super.propertyChanged(e);
 | 
			
		||||
        String name = e.getProperty().getName();
 | 
			
		||||
        if("person".equals(name)){
 | 
			
		||||
        /*if("person".equals(name)){
 | 
			
		||||
            ChangeData changeData = e.getChangeSet()[0];//获取改变的数据
 | 
			
		||||
            DynamicObject oldValue = (DynamicObject) changeData.getOldValue();
 | 
			
		||||
            DynamicObject newValue = (DynamicObject) changeData.getNewValue();
 | 
			
		||||
            if(newValue !=null){
 | 
			
		||||
                long userid = newValue.getLong("id");
 | 
			
		||||
                long mainOrgId = UserServiceHelper.getUserMainOrgId(userid);
 | 
			
		||||
                this.getModel().setValue("zcgj_persondepart", mainOrgId);
 | 
			
		||||
                this.getView().updateView("zcgj_persondepart");
 | 
			
		||||
                List<Long> orgsUserJoin = UserServiceHelper.getOrgsUserJoin(userid);
 | 
			
		||||
                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{
 | 
			
		||||
                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