feat:云之家回写代码优化,增加日志

This commit is contained in:
zzs 2024-12-19 15:09:06 +08:00
parent 4efe0c8126
commit bdd2761c16

View File

@ -73,14 +73,25 @@ public class YZJAuditController {
ArrayList<QFilter> qFilters = new ArrayList<>();
qFilters.add(new QFilter("yem_yzjid", QCP.equals, formCodeId));
qFilters.add(new QFilter("yem_isdisable", QCP.equals, false));
logger.info("QFilter{}", qFilters);
DynamicObject yem_ia_intebilllogon = BusinessDataServiceHelper.loadSingle("yem_ia_intebilllogon", qFilters.toArray(new QFilter[0]));
if (yem_ia_intebilllogon != null) {
yem_ia_intebilllogon = BusinessDataServiceHelper.loadSingle(yem_ia_intebilllogon.getLong("id"), "yem_ia_intebilllogon");
logger.info("智能审批单据注册:{}{}", yem_ia_intebilllogon.getString("billno"), yem_ia_intebilllogon.getPkValue());
// yem_ia_intebilllogon = BusinessDataServiceHelper.loadSingle(yem_ia_intebilllogon.getLong("id"), "yem_ia_intebilllogon");
} else {
return CustomApiResult.success("调用成功");
logger.info("未获取到智能审批单据注册");
return CustomApiResult.success("调用成功(未获取到智能审批单据注册)");
}
//单据类型
String bos_entityobjectnum = yem_ia_intebilllogon.getString("yem_formid.number");
DynamicObject formType = yem_ia_intebilllogon.getDynamicObject("yem_formid");
String bos_entityobjectnum;
if (YEM.isNotEmpty(formType)) {
bos_entityobjectnum = formType.getString("number");
} else {
return CustomApiResult.fail("501", "智能审批单据注册:" + yem_ia_intebilllogon.getString("billno") + ",中单据类为空!");
}
logger.info("获取审批单据,查询条件:{}{}", bos_entityobjectnum, formInstId);
//获取单据
billObj = BusinessDataServiceHelper.loadSingle(bos_entityobjectnum, new QFilter[]{new QFilter("yem_forminstid", QCP.equals, formInstId)});
} catch (Exception e) {
@ -88,15 +99,22 @@ public class YZJAuditController {
return CustomApiResult.fail("501", e.getMessage());
}
DynamicObject ialog;
DynamicObject ialog = null;
if (YEM.isNotEmpty(billObj) && billObj.containsProperty("yem_forminstid")) {
//通过表单实例ID获取日志对象
ialog = BusinessDataServiceHelper.loadSingle("yem_ialog", new QFilter[]{new QFilter("yem_forminstid", QCP.equals, billObj.get("yem_forminstid"))});
} else {
return CustomApiResult.fail("501", "获取审批单据失败!");
try {
if (YEM.isNotEmpty(billObj)) {
//通过表单实例ID获取日志对象
ialog = BusinessDataServiceHelper.loadSingle("yem_ialog", new QFilter[]{new QFilter("yem_forminstid", QCP.equals, billObj.get("yem_forminstid"))});
} else {
return CustomApiResult.fail("501", "获取审批单据失败!");
}
} catch (Exception e) {
e.printStackTrace();
return CustomApiResult.fail("501", "获取审批日志失败!" + e.getMessage());
}
if (YEM.isNotEmpty(ialog)) {
ialog.set("yem_writeback", data);
} else {