|  | @@ -1,28 +1,30 @@
 | 
	
		
			
				|  |  |  package fi.fa.opplugin;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import com.alibaba.nacos.common.utils.StringUtils;
 | 
	
		
			
				|  |  | +import com.alibaba.druid.util.StringUtils;
 | 
	
		
			
				|  |  |  import kd.bos.dataentity.entity.DynamicObject;
 | 
	
		
			
				|  |  |  import kd.bos.dataentity.entity.DynamicObjectCollection;
 | 
	
		
			
				|  |  | -import kd.bos.form.events.AfterDoOperationEventArgs;
 | 
	
		
			
				|  |  | -import kd.bos.form.operate.FormOperate;
 | 
	
		
			
				|  |  | -import kd.bos.form.plugin.AbstractFormPlugin;
 | 
	
		
			
				|  |  | +import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
 | 
	
		
			
				|  |  | +import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
 | 
	
		
			
				|  |  | +import kd.bos.servicehelper.BusinessDataServiceHelper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -public class FaLeaseContractOpPlugin extends AbstractFormPlugin {
 | 
	
		
			
				|  |  | +public class FaLeaseContractOpPlugin extends AbstractOperationServicePlugIn {
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public void afterDoOperation(AfterDoOperationEventArgs args) {
 | 
	
		
			
				|  |  | -        super.afterDoOperation(args);
 | 
	
		
			
				|  |  | -        String operateKey = args.getOperateKey();
 | 
	
		
			
				|  |  | -        if (StringUtils.equals("submit", operateKey)){
 | 
	
		
			
				|  |  | -            DynamicObject assetcat = (DynamicObject) this.getModel().getValue("assetcat");
 | 
	
		
			
				|  |  | -            Long id = null;
 | 
	
		
			
				|  |  | -            if (assetcat != null) {
 | 
	
		
			
				|  |  | -                id = assetcat.getLong("id");
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            Boolean isexempt = (Boolean) this.getModel().getValue("isexempt");
 | 
	
		
			
				|  |  | -            DynamicObjectCollection payplanentryentitys = this.getModel().getEntryEntity("payplanentryentity");
 | 
	
		
			
				|  |  | -            for (DynamicObject payplanentryentity : payplanentryentitys) {
 | 
	
		
			
				|  |  | -                payplanentryentity.set("nckd_basedatafield", id);
 | 
	
		
			
				|  |  | -                payplanentryentity.set("nckd_checkboxfield", isexempt);
 | 
	
		
			
				|  |  | +    public void beginOperationTransaction(BeginOperationTransactionArgs e) {
 | 
	
		
			
				|  |  | +        DynamicObject[] dynamicObjects = e.getDataEntities();
 | 
	
		
			
				|  |  | +        for (int i = 0; i < dynamicObjects.length; i++) {
 | 
	
		
			
				|  |  | +            if (StringUtils.equals(e.getOperationKey(),"audit")) {
 | 
	
		
			
				|  |  | +                DynamicObject info = BusinessDataServiceHelper.loadSingle(dynamicObjects[i].getPkValue(), dynamicObjects[i].getDynamicObjectType().getName());
 | 
	
		
			
				|  |  | +                DynamicObject assetcat = info.getDynamicObject("assetcat");
 | 
	
		
			
				|  |  | +                Long id = null;
 | 
	
		
			
				|  |  | +                if (assetcat != null) {
 | 
	
		
			
				|  |  | +                    id = assetcat.getLong("id");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                Boolean isexempt = info.getBoolean("isexempt");
 | 
	
		
			
				|  |  | +                DynamicObjectCollection payplanentryentitys = info.getDynamicObjectCollection("payplanentryentity");
 | 
	
		
			
				|  |  | +                for (DynamicObject payplanentryentity : payplanentryentitys) {
 | 
	
		
			
				|  |  | +                    payplanentryentity.set("nckd_basedatafield", id);
 | 
	
		
			
				|  |  | +                    payplanentryentity.set("nckd_checkboxfield", isexempt);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 |