diff --git a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/thirdservice/user/service/impl/UserInfoServiceImpl.java b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/thirdservice/user/service/impl/UserInfoServiceImpl.java index a8953e2d..513f8915 100644 --- a/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/thirdservice/user/service/impl/UserInfoServiceImpl.java +++ b/order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/thirdservice/user/service/impl/UserInfoServiceImpl.java @@ -442,8 +442,7 @@ public class UserInfoServiceImpl implements UserInfoService { public DeptEntity querySysDeptEntity(DeptEntity deptEntity) { List groupIdList = Lists.newArrayList(); groupIdList.add(deptEntity.getDeptId()); - DeptEntity deptEntityNew = new DeptEntity(); - deptEntityNew.setDeptId(deptEntity.getDeptId()); + DeptEntity deptEntityNew = null; List entityList = groupManagementService.queryByGroupIdList(groupIdList); if (entityList != null && entityList.size() > 0) { //选出默认项 @@ -451,6 +450,8 @@ public class UserInfoServiceImpl implements UserInfoService { .filter(groupManagementEntity -> OrderInfoEnum.ORDER_KPZZGL_SFMRX_0.getKey().equals(groupManagementEntity.getDefaultItem())) .findFirst(); GroupManagementEntity groupManagementEntity = groupManagementEntityOptional.orElseGet(() -> entityList.get(0)); + deptEntityNew = new DeptEntity(); + deptEntityNew.setDeptId(deptEntity.getDeptId()); deptEntityNew.setTaxpayerCode(groupManagementEntity.getXhfNsrsbh()); //todo 虚拟组织:组织名称和销方名称公用此字段会有问题,后期优化 deptEntityNew.setName(groupManagementEntity.getGroupName()); @@ -462,7 +463,7 @@ public class UserInfoServiceImpl implements UserInfoService { deptEntityNew.setInvoiceName(groupManagementEntity.getXhfMc()); deptEntityNew.setInvoiceNsrsbh(groupManagementEntity.getXhfNsrsbh()); } - return deptEntity; + return deptEntityNew; } diff --git a/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/api/InvoiceRestApiV6.java b/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/api/InvoiceRestApiV6.java index 753620a1..a27c874a 100644 --- a/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/api/InvoiceRestApiV6.java +++ b/order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/api/InvoiceRestApiV6.java @@ -222,13 +222,10 @@ public class InvoiceRestApiV6 { PoCommonRequestParam poCommonRequestParam = JsonUtils.getInstance().parseObject(reqStr, PoCommonRequestParam.class); Map zData = JsonUtils.getInstance().parseObject(poCommonRequestParam.getIS_INPUT().getZDATA(), Map.class); DeptEntity deptEntity = userInfoService.querySysDeptEntityByEnterpriseNumbers(zData.get("BUKRS").toString()); - if(ObjectUtil.isNotNull(deptEntity) && StringUtils.isNotBlank(deptEntity.getDeptId())){ + if(deptEntity != null){ deptEntity = userInfoService.querySysDeptEntity(deptEntity); - DdpcxxReqBO ddpcxxReq = BeanTransitionUtils.transitionPoKpReq(poCommonRequestParam,deptEntity); - DdpcxxRspV5 ddpcxxRspV5 = interfaceServiceV6.generateQdInvoiceV6(ddpcxxReq, secretId, null); - PoCommonResponseParam poCommonResponseParam = BeanTransitionUtils.transitionPoKpResp(ddpcxxRspV5); - returnJsonString = JsonUtils.getInstance().toJsonString(poCommonResponseParam); - }else{ + } + if(deptEntity == null){ PoCommonResponseParam poCommonResponseParam = new PoCommonResponseParam(); EsOutput esOutput = new EsOutput(); esOutput.setBSKEY(poCommonRequestParam.getIS_INPUT().getBSKEY()); @@ -238,6 +235,11 @@ public class InvoiceRestApiV6 { poCommonResponseParam.setES_OUTPUT(esOutput); return JsonUtils.getInstance().toJsonString(poCommonResponseParam); } + + DdpcxxReqBO ddpcxxReq = BeanTransitionUtils.transitionPoKpReq(poCommonRequestParam,deptEntity); + DdpcxxRspV5 ddpcxxRspV5 = interfaceServiceV6.generateQdInvoiceV6(ddpcxxReq, secretId, null); + PoCommonResponseParam poCommonResponseParam = BeanTransitionUtils.transitionPoKpResp(ddpcxxRspV5); + returnJsonString = JsonUtils.getInstance().toJsonString(poCommonResponseParam); } else if (ConfigurerInfo.GETORDERINFOANDINVOICEINFO.equals(interfaceName)){ //订单和发票数据查询接口 DdfpcxReqV5 ddfpcxReq = JsonUtils.getInstance().parseObject(reqStr, DdfpcxReqV5.class);