diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/wscustomersynchronizationevent/service/impl/WsCustomerSynchronizationEventServiceImpl.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/wscustomersynchronizationevent/service/impl/WsCustomerSynchronizationEventServiceImpl.java index f46fc74b..7b36cc1c 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/wscustomersynchronizationevent/service/impl/WsCustomerSynchronizationEventServiceImpl.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/wscustomersynchronizationevent/service/impl/WsCustomerSynchronizationEventServiceImpl.java @@ -12,21 +12,23 @@ import com.hzya.frame.plugin.wscustomersynchronizationevent.entity.WsCustomerSyn import com.hzya.frame.plugin.wscustomersynchronizationevent.service.IWsCustomerSynchronizationEventService; import com.hzya.frame.web.entity.BaseResult; import com.hzya.frame.web.entity.JsonResultEntity; +import com.sun.org.apache.xerces.internal.dom.DeferredEntityReferenceImpl; import org.springframework.beans.factory.annotation.Autowired; -import java.util.HashMap; import java.util.Map; /*** * 万盛客商档案同步插件 * @content: * @author 👻👻👻👻👻👻👻👻 gjh - * @date 2025-03-03 10:56 + * @date 2025-03-03 10:56 * @param * @return **/ public class WsCustomerSynchronizationEventServiceImpl extends BaseService implements IWsCustomerSynchronizationEventService { - + //定义两个环境属性,根据环境绑定OA参数 + private final String TEST = "TEST"; + private final String DEV = "DEV"; private IWsCustomerSynchronizationEventDao wsCustomerSynchronizationEventDao; @Autowired @@ -37,90 +39,94 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService0){ + if (allcount > 0) { return BaseResult.getFailureMessageEntity("客商名称重复!"); - }else{ + } else { requestJson = new JSONObject(); - requestJson.put("taxpayer",field0007); - body = requestApi("validateCustomerName",requestJson, "800054","8000540095",null); - req = JSON.parseObject(body); - flag = req.getBoolean("flag"); - if(flag){ - attribute = req.getJSONObject("attribute"); - status = attribute.getString("status"); - if("success".equals(status)){ - detailsData = attribute.getJSONObject("data"); - allcount = detailsData.getInteger("allcount"); - if(allcount>0){ - return BaseResult.getFailureMessageEntity("纳税人识别号重复!"); - }else{ - return BaseResult.getSuccessMessageEntity("客商未重复!"); + if(null != field0007 && !"".equals(field0007)){ + if(field0007.trim().length()>18){ + return BaseResult.getFailureMessageEntity("纳税人识别号不允许超过18位!"); + } + requestJson.put("taxpayer", field0007.trim()); + body = requestApi("validateCustomerName", requestJson, "800054", "8000540095", null); + req = JSON.parseObject(body); + flag = req.getBoolean("flag"); + if (flag) { + attribute = req.getJSONObject("attribute"); + status = attribute.getString("status"); + if ("success".equals(status)) { + detailsData = attribute.getJSONObject("data"); + allcount = detailsData.getInteger("allcount"); + if (allcount > 0) { + return BaseResult.getFailureMessageEntity("纳税人识别号重复!"); + } else { + return BaseResult.getSuccessMessageEntity("客商未重复!"); + } + } else { + return BaseResult.getFailureMessageEntity("转发失败!"); } - }else{ - return BaseResult.getFailureMessageEntity("转发失败!"); + } else { + return BaseResult.getFailureMessageEntity("转发失败!" + req.getString("msg")); } }else{ - return BaseResult.getFailureMessageEntity("转发失败!"+req.getString("msg")); + return BaseResult.getSuccessMessageEntity("纳税人识别号为空,不校验!"); } } - }else{ + } else { return BaseResult.getFailureMessageEntity("转发失败!"); } - }else{ + } else { - return BaseResult.getFailureMessageEntity("转发失败!"+req.getString("msg")); + return BaseResult.getFailureMessageEntity("转发失败!" + req.getString("msg")); } - - - } @@ -128,7 +134,7 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService0){ + if (null != returnData && returnData.size() > 0) { pk_cubasdoc = returnData.getJSONObject(0).getJSONObject("parentvo").getString("pk_cubasdoc"); String custcode = returnData.getJSONObject(0).getJSONObject("parentvo").getString("custcode"); //执行客商档案编码回传OA - updateCustomerCode(formBean.getString("id"),custcode); + updateCustomerCode(formBean.getString("id"), custcode,DEV); } - logger.info("客商新增成功!返回数据",body); + logger.info("客商新增成功!返回数据", body); } else { - logger.info("客商新增失败!返回数据",body); + logger.info("客商新增失败!返回数据", body); } } else { return BaseResult.getFailureMessageEntity("转发失败!" + req.getJSONObject("attribute").getString("errormsg")); } //绑定客商分配参数 - requestJson = bindMerchantDefineParameters(data,pk_cubasdoc); - body = requestApi("optionCustomerSynchronization客商分配",requestJson, "800054","8000540094",null); + requestJson = bindMerchantDefineParameters(data, pk_cubasdoc,DEV); + body = requestApi("optionCustomerSynchronization客商分配", requestJson, "800054", "8000540094", null); req = JSON.parseObject(body); flag = req.getBoolean("flag"); if (flag) { JSONObject attribute = req.getJSONObject("attribute"); String status = attribute.getString("status"); if ("success".equals(status)) { - logger.info("客商分配成功!返回数据",body); + logger.info("客商分配成功!返回数据", body); } else { - logger.info("客商分配失败!返回数据",body); + logger.info("客商分配失败!返回数据", body); } } else { return BaseResult.getFailureMessageEntity("转发失败!" + req.getJSONObject("attribute").getString("errormsg")); @@ -189,53 +195,73 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService headerMap = MapBuilder.create(true) .put("apiCode", String.valueOf(apiCode)) //这里用中台做为发送方 .put("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj") .put("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=") - .put("appId",appId) + .put("appId", appId) .build(); - if(null != token){ - headerMap .put("token",token); - } - String body = HttpRequest.post("http://127.0.0.1:10086/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(requestJson.toJSONString()).timeout(60000).execute().body(); - logger.info("中台转发到ESB"+method+":{}", body); + if (null != token) { + headerMap.put("token", token); + } + String body = HttpRequest.post("http://127.0.0.1:10085/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(requestJson.toJSONString()).timeout(60000).execute().body(); + logger.info("中台转发到ESB" + method + ":{}", body); return body; } @@ -288,11 +315,11 @@ public class WsCustomerSynchronizationEventServiceImpl extends BaseService