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"