62 lines
3.1 KiB
Java
62 lines
3.1 KiB
Java
package tqq9.lc123.cloud.app.plugin.task;
|
|
|
|
import kd.bos.context.RequestContext;
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
import kd.bos.entity.basedata.AssignQueryResponse;
|
|
import kd.bos.exception.KDException;
|
|
import kd.bos.logging.Log;
|
|
import kd.bos.logging.LogFactory;
|
|
import kd.bos.orm.query.QCP;
|
|
import kd.bos.orm.query.QFilter;
|
|
import kd.bos.schedule.executor.AbstractTask;
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
import kd.bos.servicehelper.DispatchServiceHelper;
|
|
import kd.bos.servicehelper.basedata.BaseDataServiceHelper;
|
|
import kd.sdk.plugin.Plugin;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
public class VendorSyncTask extends AbstractTask implements Plugin {
|
|
private final static Log logger = LogFactory.getLog(VendorSyncTask.class);
|
|
|
|
@Override
|
|
public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
|
|
|
|
QFilter qFilter1 = new QFilter("tqq9_pushywzt", QCP.equals, false);
|
|
QFilter qFilter2 = new QFilter("status", QCP.equals, "C");
|
|
DynamicObject[] supplierArr = BusinessDataServiceHelper.load("bd_supplier", "number", new QFilter[]{qFilter1, qFilter2});
|
|
if (supplierArr != null || supplierArr.length > 0) {
|
|
for (DynamicObject supplier : supplierArr) {
|
|
List<Object> paras = new ArrayList<>();
|
|
supplier = BusinessDataServiceHelper.loadSingle(supplier.getPkValue(), supplier.getDynamicObjectType().getName());
|
|
List<Long> idList = new ArrayList<>();
|
|
idList.add(supplier.getLong("id"));
|
|
AssignQueryResponse response = BaseDataServiceHelper.assignQueryByData(idList, "bd_supplier", supplier.getDynamicObject("createorg").getLong("id"), "isvb");
|
|
Map<Long, List<Long>> responseMap = response.getData();
|
|
if (responseMap != null && responseMap.size() > 0) {
|
|
DynamicObjectCollection bankEntries = supplier.getDynamicObjectCollection("entry_bank");
|
|
for (DynamicObject bankEntry : bankEntries) {
|
|
DynamicObject bank = bankEntry.getDynamicObject("bank");
|
|
if (bank != null) {
|
|
bank = BusinessDataServiceHelper.loadSingle(bank.getPkValue(), bank.getDynamicObjectType().getName());
|
|
bankEntry.set("bank", bank);
|
|
}
|
|
}
|
|
paras.add(supplier);
|
|
Object o = DispatchServiceHelper.invokeBizService("isc", "iscb", "IscFlowService",
|
|
"execute", "midplatHub_mpsup_rg", paras);
|
|
HashMap<String, Object> o1 = (HashMap<String, Object>) o;
|
|
LinkedHashMap output = (LinkedHashMap) o1.get("output");
|
|
logger.info("供应商" + supplier.getString("number") + "output:" + output);
|
|
} else {
|
|
logger.info("供应商" + supplier.getString("number") + "未进行分配");
|
|
}
|
|
}
|
|
} else {
|
|
logger.info("无供应商信息");
|
|
}
|
|
}
|
|
}
|