From 472cb2f2f792f34207e42895ae6d1923da205412 Mon Sep 17 00:00:00 2001 From: vayne Date: Mon, 27 May 2024 17:24:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E7=AE=A1=E4=BE=9B=E5=BA=94=E5=95=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../YunguanInterfaceController.java | 99 +++++++++++-------- 1 file changed, 57 insertions(+), 42 deletions(-) diff --git a/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/YunguanInterfaceController.java b/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/YunguanInterfaceController.java index b365dd53..4c3d2623 100644 --- a/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/YunguanInterfaceController.java +++ b/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/YunguanInterfaceController.java @@ -78,9 +78,10 @@ public class YunguanInterfaceController { } SubjectbasicEntity entity = subjectbasicService.getInfo(jsonObject.get("ID").toString()); if (ObjectUtil.isNotEmpty(entity)){ + //更新客户 entity.setName(jsonObject.get("CUST_FULL_NAME").toString());//名称 - entity.setCalssify("1");//一级 - entity.setSubjectBasicType("1");//客户 +// entity.setCalssify("1");//一级 +// entity.setSubjectBasicType("1");//客户 entity.setCode(jsonObject.get("CUST_NUMBER").toString());//编码 entity.setKucunOrgCode(jsonObject.get("ORGANIZATION_CODE").toString());//库存组织编码 DictionaryyunguandataEntity dictionaryyunguandataEntity = dictionaryyunguandataService.getDateValueInfo("564773000885326917",entity.getKucunOrgCode()); @@ -99,8 +100,9 @@ public class YunguanInterfaceController { String organizeId = JSON.toJSONString(conpanyIdList); entity.setOrganizeJsonId(organizeId);//分支机构编码 } - subjectbasicService.updateById(entity);//更新客户 + subjectbasicService.updateById(entity); }else { + //新增客户 SubjectbasicEntity subjectbasicEntity = new SubjectbasicEntity(); subjectbasicEntity.setId(jsonObject.get("ID").toString());//ID subjectbasicEntity.setName(jsonObject.get("CUST_FULL_NAME").toString());//名称 @@ -124,7 +126,7 @@ public class YunguanInterfaceController { String organizeId = JSON.toJSONString(conpanyIdList); subjectbasicEntity.setOrganizeJsonId(organizeId);//分支机构编码 } - subjectbasicService.save(subjectbasicEntity);//新增客户 + subjectbasicService.save(subjectbasicEntity); } return ActionResult.success("运管推送客户数据到智慧成功"); } @@ -147,45 +149,58 @@ public class YunguanInterfaceController { if(!ObjectUtil.equal(jsonObject.get("INTF_STATUS").toString(), "S")){ return ActionResult.fail("请推送状态为S的供应商"); } - SubjectbasicEntity subjectbasicEntity = new SubjectbasicEntity(); - subjectbasicEntity.setName(jsonObject.get("VENDOR_NAME").toString());//名称 - subjectbasicEntity.setCalssify("1");//一级 - subjectbasicEntity.setSubjectBasicType("2");//供应商 - subjectbasicEntity.setCode(jsonObject.get("VENDOR_NUM").toString());//编码 - subjectbasicEntity.setKucunOrgCode(jsonObject.get("ATTR3").toString());//库存组织编码 - if(ObjectUtil.equal("CK0", subjectbasicEntity.getKucunOrgCode())){ - subjectbasicEntity.setKucunOrgName("济钢城市矿产科技有限公司"); - }else if(ObjectUtil.equal("CK1", subjectbasicEntity.getKucunOrgCode())){ - subjectbasicEntity.setKucunOrgName("济钢城市矿产科技有限公司(日照)"); - }else if(ObjectUtil.equal("CK2", subjectbasicEntity.getKucunOrgCode())){ - subjectbasicEntity.setKucunOrgName("山东济钢愿景工业科技有限公司"); - }else if(ObjectUtil.equal("CK3", subjectbasicEntity.getKucunOrgCode())){ - subjectbasicEntity.setKucunOrgName("济钢城市矿产科技(佛山)有限公司"); - }else if(ObjectUtil.equal("RJ0", subjectbasicEntity.getKucunOrgCode())){ - subjectbasicEntity.setKucunOrgName("日照济钢金属科技有限公司"); - }else if(ObjectUtil.equal("RJ1", subjectbasicEntity.getKucunOrgCode())){ - subjectbasicEntity.setKucunOrgName("日照济钢金属科技有限公司(生产)"); - }else if(ObjectUtil.equal("JT1", subjectbasicEntity.getKucunOrgCode())){ - subjectbasicEntity.setKucunOrgName("济钢集团有限公司广东分公司"); - } - if(ObjectUtil.equal("A级", jsonObject.get("ATTR1").toString())){ - subjectbasicEntity.setReservedFields3("1"); - }else if(ObjectUtil.equal("B级", jsonObject.get("ATTR1").toString())){ - subjectbasicEntity.setReservedFields3("2"); - }else if(ObjectUtil.equal("C级", jsonObject.get("ATTR1").toString())){ - subjectbasicEntity.setReservedFields3("3"); - }else if(ObjectUtil.equal("D级", jsonObject.get("ATTR1").toString())){ - subjectbasicEntity.setReservedFields3("4"); - } - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().eq(OrganizeEntity::getEnCode, jsonObject.get("ORG_ID").toString()); - List orgList = organizeService.list(queryWrapper); - if(orgList != null && orgList.size() > 0){ - List conpanyIdList = Arrays.asList(orgList.get(0).getCompanyIdTree().split(",")); - String organizeId = JSON.toJSONString(conpanyIdList); - subjectbasicEntity.setOrganizeJsonId(organizeId);//分支机构编码 + SubjectbasicEntity entity = subjectbasicService.getInfo(jsonObject.get("ID").toString()); + if (ObjectUtil.isNotEmpty(entity)){ + //更新供应商 + entity.setName(jsonObject.get("VENDOR_NAME").toString());//名称 +// entity.setCalssify("1");//一级 +// entity.setSubjectBasicType("2");//供应商 + entity.setCode(jsonObject.get("VENDOR_NUM").toString());//编码 + entity.setKucunOrgCode(jsonObject.get("ATTR3").toString());//库存组织编码 + DictionaryyunguandataEntity dictionaryyunguandataEntity = dictionaryyunguandataService.getDateValueInfo("564773000885326917",entity.getKucunOrgCode()); + if (ObjectUtil.isNotEmpty(dictionaryyunguandataEntity)) { + entity.setKucunOrgName(dictionaryyunguandataEntity.getZhihuiValue()); + } + DictionaryyunguandataEntity dictionaryyunguandataEntity1 = dictionaryyunguandataService.getDateValueInfo("564775124784403525",jsonObject.get("ATTR2").toString()); + if (ObjectUtil.isNotEmpty(dictionaryyunguandataEntity1)){ + entity.setReservedFields3(dictionaryyunguandataEntity1.getZhihuiValue()); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(OrganizeEntity::getEnCode, jsonObject.get("ORG_ID").toString()); + List orgList = organizeService.list(queryWrapper); + if(orgList != null && orgList.size() > 0){ + List conpanyIdList = Arrays.asList(orgList.get(0).getCompanyIdTree().split(",")); + String organizeId = JSON.toJSONString(conpanyIdList); + entity.setOrganizeJsonId(organizeId);//分支机构编码 + } + subjectbasicService.updateById(entity); + }else { + //新增供应商 + SubjectbasicEntity subjectbasicEntity = new SubjectbasicEntity(); + subjectbasicEntity.setId(jsonObject.get("ID").toString());//ID + subjectbasicEntity.setName(jsonObject.get("VENDOR_NAME").toString());//名称 + subjectbasicEntity.setCalssify("1");//一级 + subjectbasicEntity.setSubjectBasicType("2");//供应商 + subjectbasicEntity.setCode(jsonObject.get("VENDOR_NUM").toString());//编码 + subjectbasicEntity.setKucunOrgCode(jsonObject.get("ATTR3").toString());//库存组织编码 + DictionaryyunguandataEntity dictionaryyunguandataEntity = dictionaryyunguandataService.getDateValueInfo("564773000885326917",entity.getKucunOrgCode()); + if (ObjectUtil.isNotEmpty(dictionaryyunguandataEntity)) { + entity.setKucunOrgName(dictionaryyunguandataEntity.getZhihuiValue()); + } + DictionaryyunguandataEntity dictionaryyunguandataEntity1 = dictionaryyunguandataService.getDateValueInfo("564775124784403525",jsonObject.get("ATTR2").toString()); + if (ObjectUtil.isNotEmpty(dictionaryyunguandataEntity1)){ + entity.setReservedFields3(dictionaryyunguandataEntity1.getZhihuiValue()); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(OrganizeEntity::getEnCode, jsonObject.get("ORG_ID").toString()); + List orgList = organizeService.list(queryWrapper); + if (orgList != null && orgList.size() > 0) { + List conpanyIdList = Arrays.asList(orgList.get(0).getCompanyIdTree().split(",")); + String organizeId = JSON.toJSONString(conpanyIdList); + subjectbasicEntity.setOrganizeJsonId(organizeId);//分支机构编码 + } + subjectbasicService.save(subjectbasicEntity); } - subjectbasicService.save(subjectbasicEntity); return ActionResult.success("运管推送供应商数据到智慧成功"); }