43 lines
1.7 KiB
Java
43 lines
1.7 KiB
Java
package shkd.repc.resm.opplugin;
|
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
|
import kd.bos.util.StringUtils;
|
|
import kd.sdk.plugin.Plugin;
|
|
import shkd.utils.OAUtils;
|
|
|
|
import static shkd.utils.OAUtils.pushOASupplier;
|
|
|
|
/**
|
|
* 单据操作插件
|
|
* 更新OA供应商数据
|
|
*/
|
|
public class UpdateOASupplierInfoOPPlugin extends AbstractOperationServicePlugIn implements Plugin {
|
|
|
|
@Override
|
|
public void afterExecuteOperationTransaction(AfterOperationArgs e){
|
|
super.afterExecuteOperationTransaction(e);
|
|
//todo:定时任务推送所有供应商 变更审核||供应商审核操作之后推送供应商
|
|
String operationKey = e.getOperationKey();
|
|
if ("updateOAInfo".equals(operationKey)) {
|
|
for (DynamicObject dataEntity : e.getDataEntities()) {
|
|
String name = dataEntity.getDynamicObjectType().getName();
|
|
String supplierName = "";
|
|
DynamicObject supplier = null;
|
|
if ("resm_change_supplier".equals(name)) {
|
|
supplierName = dataEntity.getDynamicObject("supplier").getString("name");
|
|
supplier = dataEntity.getDynamicObject("supplier");
|
|
}else {
|
|
supplierName = dataEntity.getString("name");
|
|
supplier = dataEntity;
|
|
}
|
|
//获取token
|
|
String oaToken = OAUtils.getOaToken(supplierName);
|
|
if (StringUtils.isNotEmpty(oaToken) && null != supplier) {
|
|
pushOASupplier(oaToken,supplier);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |