From 468c603d30095db2a319f1c6b5812841789e9bdf Mon Sep 17 00:00:00 2001 From: yuxueliang0813 <407010292@qq.com> Date: Thu, 22 May 2025 17:13:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=8E=A5=E5=8F=A3=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E6=A0=87=E5=87=86=E5=A4=84=E7=90=861?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jhzj7/fi/fi/webapi/CustomerControler.java | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/main/java/shjh/jhzj7/fi/fi/webapi/CustomerControler.java b/main/java/shjh/jhzj7/fi/fi/webapi/CustomerControler.java index 6be4568..6233491 100644 --- a/main/java/shjh/jhzj7/fi/fi/webapi/CustomerControler.java +++ b/main/java/shjh/jhzj7/fi/fi/webapi/CustomerControler.java @@ -21,9 +21,7 @@ import kd.bos.openapi.common.result.CustomApiResult; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.operation.OperationServiceHelper; -import kd.bos.servicehelper.operation.SaveServiceHelper; import shjh.jhzj7.fi.fi.utils.EsbUtils; -import shjh.jhzj7.fi.fi.utils.JhzjUtils; import shjh.jhzj7.fi.fi.webapi.model.CustomerModel; import javax.validation.Valid; @@ -144,14 +142,6 @@ public class CustomerControler { //处理 客户组5 handleFive(customerfivesJson,currentCus.getDynamicObjectCollection("shjh_entry_five"),cusnumber); - //处理分类 - custgroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName); - custgroupdetail.set("createorg", JhzjUtils.GROUPID);//创建组织 - custgroupdetail.set("standard",EsbUtils.CUSTOMERSTAND);//客户分类标准 - custgroupdetail.set("group",custype);//具体分类 - custgroupdetail.set("customer",currentCustId);//客户 - SaveServiceHelper.save(new DynamicObject[]{custgroupdetail}); - //保存客户-必须调用保存操作,否则不符合受控基础资料开发规范 // SaveServiceHelper.save(new DynamicObject[]{currentCus}); operResult = OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentCus}, oop); @@ -162,6 +152,26 @@ public class CustomerControler { itemInfo.put("error","客户保存失败"+operResult.getMessage()); itemsJson.add(itemInfo); } + //处理分类-客户只有一个分类 + custgroupdetail = BusinessDataServiceHelper.loadSingle(gdName,new QFilter[]{ + new QFilter("customer.id","=",currentCustId)}); + if(custgroupdetail == null){ + custgroupdetail = BusinessDataServiceHelper.newDynamicObject(gdName); + custgroupdetail.set("createorg", grouporginfo);//创建组织 + custgroupdetail.set("standard",EsbUtils.CUSTOMERSTAND);//客户分类标准 + custgroupdetail.set("customer",currentCus);//客户 + } + + custgroupdetail.set("group",custype);//具体分类 +// SaveServiceHelper.save(new DynamicObject[]{custgroupdetail}); + operResult = OperationServiceHelper.executeOperate("save", gdName, new DynamicObject[]{custgroupdetail}, oop); + if(!operResult.isSuccess()){ + log.error(String.format("客户分类保存失败:%s", json_body.toJSONString())); + itemInfo = new JSONObject(); + itemInfo.put("code",cusnumber); + itemInfo.put("error","客户分类保存失败"+operResult.getMessage()); + itemsJson.add(itemInfo); + } }else{ //修改客户 名称 税务登记号 联系人 联系电话 银行信息 客户组5 currentCustId = currentCus.getLong("id");