Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
0851c7cd86
|
|
@ -0,0 +1,47 @@
|
|||
package shkd.sys.sys.plugin.api;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.openapi.api.plugin.ApiSavePlugin;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class KjkmApiSavePlugin implements Serializable, ApiSavePlugin {
|
||||
private static final long serialVersionUID = -5789692225841588799L;
|
||||
private static final Log logger = LogFactory.getLog(RyApiSavePlugin.class);
|
||||
/**
|
||||
* 人员API保存插件
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> preHandleRequestData(List<Map<String, Object>> reqData) {
|
||||
logger.info("API起始推送数据 → 会计科目 → " + reqData);
|
||||
for (Map<String, Object> oneLevel : reqData) {
|
||||
Map<String, Object> parent = (Map<String, Object>) oneLevel.get("parent");//浪潮部门
|
||||
if (parent != null) {
|
||||
Object shkdLcid = parent.get("shkd_lcid");
|
||||
if (shkdLcid != null) {
|
||||
String shkdLcidString = shkdLcid.toString();
|
||||
if ("".equals(shkdLcidString)) {
|
||||
oneLevel.remove("parent");
|
||||
} else {
|
||||
DynamicObject[] bdAccountviews = BusinessDataServiceHelper.load("bd_accountview", "id,number,name,shkd_lcid", new QFilter("shkd_lcid", QCP.equals, shkdLcidString).toArray());
|
||||
if (bdAccountviews.length == 1) {
|
||||
Map<String, Object> parentObj = new HashMap<>();
|
||||
parentObj.put("number", bdAccountviews[0].get("number"));
|
||||
oneLevel.put("parent", parentObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("API最终推送数据 → 会计科目 → " + reqData);
|
||||
return reqData;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue