| 
									
										
										
										
											2025-10-23 10:05:11 +00:00
										 |  |  | package tqq9.lc123.cloud.app.plugin.operate.conm;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-10-25 06:43:01 +00:00
										 |  |  | import com.alibaba.fastjson.JSONObject;
 | 
					
						
							| 
									
										
										
										
											2025-10-23 10:05:11 +00:00
										 |  |  | import kd.bos.dataentity.entity.DynamicObject;
 | 
					
						
							|  |  |  | import kd.bos.entity.operate.result.OperationResult;
 | 
					
						
							|  |  |  | import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
 | 
					
						
							|  |  |  | import kd.bos.entity.plugin.args.AfterOperationArgs;
 | 
					
						
							|  |  |  | import kd.bos.servicehelper.BusinessDataServiceHelper;
 | 
					
						
							|  |  |  | import kd.bos.servicehelper.QueryServiceHelper;
 | 
					
						
							| 
									
										
										
										
											2025-10-25 06:43:01 +00:00
										 |  |  | import kd.bos.servicehelper.operation.SaveServiceHelper;
 | 
					
						
							|  |  |  | import org.apache.commons.lang3.StringUtils;
 | 
					
						
							| 
									
										
										
										
											2025-10-23 10:05:11 +00:00
										 |  |  | import tqq9.lc123.cloud.app.plugin.trd.FWImpl;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import java.util.List;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * 采购合同提交  推送泛微
 | 
					
						
							|  |  |  |  */
 | 
					
						
							|  |  |  | public class PurconmSubmitToFwOp extends AbstractOperationServicePlugIn {
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @Override
 | 
					
						
							|  |  |  |     public void afterExecuteOperationTransaction(AfterOperationArgs e) {
 | 
					
						
							|  |  |  |         super.afterExecuteOperationTransaction(e);
 | 
					
						
							|  |  |  |         OperationResult operationResult = this.getOperationResult();
 | 
					
						
							|  |  |  |         List<Object> successPkIds = operationResult.getSuccessPkIds();
 | 
					
						
							|  |  |  |         for (Object successPkId : successPkIds) {
 | 
					
						
							|  |  |  |             DynamicObject bill = null;
 | 
					
						
							|  |  |  |             String resultStr = null;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             boolean existOrder = QueryServiceHelper.exists("conm_purcontract", successPkId);
 | 
					
						
							|  |  |  |             if(existOrder){
 | 
					
						
							|  |  |  |                 bill = BusinessDataServiceHelper.loadSingle(successPkId, "conm_purcontract");
 | 
					
						
							|  |  |  |                 resultStr = FWImpl.pushFwPurconm(bill);
 | 
					
						
							|  |  |  |             }else{
 | 
					
						
							|  |  |  |                 boolean existChange = QueryServiceHelper.exists("conm_xpurcontract", successPkId);
 | 
					
						
							|  |  |  |                 if(existChange){
 | 
					
						
							|  |  |  |                     bill = BusinessDataServiceHelper.loadSingle(successPkId, "conm_xpurcontract");
 | 
					
						
							| 
									
										
										
										
											2025-10-25 06:43:01 +00:00
										 |  |  |                     resultStr = FWImpl.pushFwPurconmChange(bill);
 | 
					
						
							|  |  |  |                 }
 | 
					
						
							|  |  |  |             }
 | 
					
						
							|  |  |  |             if(StringUtils.isNotBlank(resultStr)){
 | 
					
						
							|  |  |  |                 JSONObject resultObj = JSONObject.parseObject(resultStr);
 | 
					
						
							|  |  |  |                 String code = resultObj.getString("code");
 | 
					
						
							|  |  |  |                 if("SUCCESS".equals(code)){
 | 
					
						
							|  |  |  |                     JSONObject data = resultObj.getJSONObject("data");
 | 
					
						
							|  |  |  |                     if(data != null){
 | 
					
						
							|  |  |  |                         String requestid = data.getString("requestid");
 | 
					
						
							|  |  |  |                         bill.set("tqq9_fwrequestid", requestid);
 | 
					
						
							|  |  |  |                         SaveServiceHelper.save(new DynamicObject[]{bill});
 | 
					
						
							|  |  |  |                     }
 | 
					
						
							| 
									
										
										
										
											2025-10-23 10:05:11 +00:00
										 |  |  |                 }
 | 
					
						
							|  |  |  |             }
 | 
					
						
							|  |  |  |             
 | 
					
						
							|  |  |  |         }
 | 
					
						
							|  |  |  |     }
 | 
					
						
							|  |  |  | }
 |