From 6e0ed73954666c31c12faa5351233790b6ad4396 Mon Sep 17 00:00:00 2001 From: chenrui <1950717904@qq.com> Date: Thu, 21 Nov 2024 19:48:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9=E5=B8=82?= =?UTF-8?q?=E7=9B=91=E6=89=AB=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnterpriseInformationServiceImpl.java | 28 +++++++++++++++++-- .../mapper/EnterpriseInformationMapper.xml | 2 +- .../resources/mapper/SsztJbxx110497Mapper.xml | 2 +- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseInformationServiceImpl.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseInformationServiceImpl.java index 81142f33..6fe44e2c 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseInformationServiceImpl.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseInformationServiceImpl.java @@ -15,9 +15,11 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.util.IdUtil; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.zdxt.auth.dto.UserBean; import com.zdxt.auth.feign.FileUploadApi; import com.zdxt.auth.feign.UserApi; @@ -424,8 +426,30 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS //获取路由中的cid //解析路由获取企业统一信用代码 String cid = getUrlParams(url, "cid"); + log.info("企业信息表中查询企业信息,统一信用代码:{}", cid); if(StringUtils.isNotEmpty(cid)){ - EnterpriseInformation enterpriseInformation = ssztJbxx110497Service.selectSsztJbxx110497ByCode(cid); + //初始化对象 + EnterpriseInformation enterpriseInformation = null; + //查询企业表中是否存在企业信息 + enterpriseInformation = enterpriseInformationMapper.selectEnterpriseInformationByNum(cid); + log.info("企业信息表中查询企业信息,企业:{}", JSONObject.toJSONString(enterpriseInformation)); + + if(BeanUtil.isEmpty(enterpriseInformation) && + StringUtils.isEmpty(enterpriseInformation.getEnterpriseNumber())){ + enterpriseInformation = ssztJbxx110497Service.selectSsztJbxx110497ByCode(cid); + if(BeanUtil.isNotEmpty(enterpriseInformation) && + StringUtils.isNotEmpty(enterpriseInformation.getEnterpriseNumber())){ + //默认ID + enterpriseInformation.setId(IdUtil.simpleUUID()); + //企业表中新增 + int i = enterpriseInformationMapper.insertEnterpriseInformation(enterpriseInformation); + if(i > 0){ + log.info("企业信息表中新增成功,新增企业:{}", JSONObject.toJSONString(enterpriseInformation)); + }else{ + log.info("企业信息表中新增失败,失败企业:{}", JSONObject.toJSONString(enterpriseInformation)); + } + } + } return enterpriseInformation; }else { //爬取页面统一信用代码 @@ -532,7 +556,7 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS // 将查询字符串拆分为键值对 Map queryParams = new HashMap<>(); if (query != null) { - String[] pairs = query.split("&"); + String[] pairs = query.split("&"); for (String pair : pairs) { int idx = pair.indexOf("="); String key = pair.substring(0, idx); diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml index 806d4612..421b5cdb 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnterpriseInformationMapper.xml @@ -142,7 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/SsztJbxx110497Mapper.xml b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/SsztJbxx110497Mapper.xml index 9710f7c0..6b278910 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/SsztJbxx110497Mapper.xml +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/SsztJbxx110497Mapper.xml @@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"