|
@@ -1,6 +1,5 @@
|
|
package com.pavis.app.saasbacken.service.impl.base;
|
|
package com.pavis.app.saasbacken.service.impl.base;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
|
|
import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
|
|
@@ -138,15 +137,15 @@ public class EnterpriseBasicInfoServiceImpl extends ServiceImpl<EnterpriseBasicI
|
|
// todo 需要保存企业信息,再处理人员信息。
|
|
// todo 需要保存企业信息,再处理人员信息。
|
|
|
|
|
|
// todo 企业负责人/法人信息关联id,需要将联系人信息新增至人员信息表。同时应该配置至企业与人员信息关联关系表。
|
|
// todo 企业负责人/法人信息关联id,需要将联系人信息新增至人员信息表。同时应该配置至企业与人员信息关联关系表。
|
|
- addBasicInfo.setChargeDirectorId("");
|
|
|
|
- // 企业联系人
|
|
|
|
- addBasicInfo.setContactsId("");
|
|
|
|
- // 研发负责人信息关联id
|
|
|
|
- addBasicInfo.setResearchDevDirectorId("");
|
|
|
|
- // 财务负责人信息关联id
|
|
|
|
- addBasicInfo.setFinancialDirectorId("");
|
|
|
|
- // 科技联络人信息关联id
|
|
|
|
- addBasicInfo.setTechnicalDirectorId("");
|
|
|
|
|
|
+ // addBasicInfo.setChargeDirectorId("");
|
|
|
|
+ // // 企业联系人
|
|
|
|
+ // addBasicInfo.setContactsId("");
|
|
|
|
+ // // 研发负责人信息关联id
|
|
|
|
+ // addBasicInfo.setResearchDevDirectorId("");
|
|
|
|
+ // // 财务负责人信息关联id
|
|
|
|
+ // addBasicInfo.setFinancialDirectorId("");
|
|
|
|
+ // // 科技联络人信息关联id
|
|
|
|
+ // addBasicInfo.setTechnicalDirectorId("");
|
|
// todo 还要考虑到企业库的其他信息的录入,主要包含了高企管理相关录入信息。
|
|
// todo 还要考虑到企业库的其他信息的录入,主要包含了高企管理相关录入信息。
|
|
// 行业领域也由节点管理员进行配置。
|
|
// 行业领域也由节点管理员进行配置。
|
|
addBasicInfos.add(addBasicInfo);
|
|
addBasicInfos.add(addBasicInfo);
|
|
@@ -192,199 +191,6 @@ public class EnterpriseBasicInfoServiceImpl extends ServiceImpl<EnterpriseBasicI
|
|
return esService.selEsByName(addBasicInfos.get(0).getName());
|
|
return esService.selEsByName(addBasicInfos.get(0).getName());
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public List<EnterpriseBasicInfo> orgBasicAdd(List<Object> basicInfo) throws IOException {
|
|
|
|
- List<OrgInfo> basicInfos = JSONObject.parseArray(JSONObject.toJSONString(basicInfo), OrgInfo.class);
|
|
|
|
- // 解析数据。
|
|
|
|
- List<EnterpriseBasicInfo> addedBasicInfos = new ArrayList<>();
|
|
|
|
- EnterpriseBasicInfo addBasicInfo;
|
|
|
|
- // 企业其他数据
|
|
|
|
- EnterpriseOtherInfo addOtherInfo;
|
|
|
|
- List<EnterpriseOtherInfo> addOtherInfos = new ArrayList<>();
|
|
|
|
- // 企业税务数据接口
|
|
|
|
- TaxInfo addTaxInfo;
|
|
|
|
- List<List<TaxInfo>> addTaxInfos = new ArrayList<>();
|
|
|
|
- List<TaxInfo> tmpTaxInfos = new ArrayList<>();
|
|
|
|
- for (OrgInfo info : basicInfos) {
|
|
|
|
- // todo 根据企业id判断是新增或者更新。 企业名称和社会统一信用代码。
|
|
|
|
- if (null == info.getId() || StringUtils.isEmpty(info.getId())) {
|
|
|
|
- // id为空,进行新增操作。
|
|
|
|
- log.info("新增操作", info.getId());
|
|
|
|
- // 根据企业名称或者社会统一信用代码
|
|
|
|
- List<EnterpriseBasicInfo> enterpriseBasicInfos = enterpriseBasicInfoMapper.selectList(new QueryWrapper<EnterpriseBasicInfo>().lambda()
|
|
|
|
- .eq(EnterpriseBasicInfo::getUnifySocialCreditCode, info.getUnifySocialCreditCode()));
|
|
|
|
- if (enterpriseBasicInfos.size() > 0) {
|
|
|
|
- // 企业基本信息已存在,
|
|
|
|
- log.info("企业基本信息已存在,主键id:{}",enterpriseBasicInfos.get(0).getId());
|
|
|
|
- info.setId(enterpriseBasicInfos.get(0).getId());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 企业基本信息
|
|
|
|
- addBasicInfo = new EnterpriseBasicInfo();
|
|
|
|
- IgnoreUtils.copyPropertiesIgnoreNull(info, addBasicInfo);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // 企业其他信息:
|
|
|
|
- addOtherInfo = new EnterpriseOtherInfo();
|
|
|
|
- IgnoreUtils.copyPropertiesIgnoreNull(info, addOtherInfo);
|
|
|
|
- addOtherInfo.setEnterpriseId(info.getId());
|
|
|
|
- // todo 待处理字段如:国高八大领域。
|
|
|
|
- addOtherInfos.add(addOtherInfo);
|
|
|
|
-
|
|
|
|
- // 企业税务数据。
|
|
|
|
- tmpTaxInfos.add(TaxInfo.builder().taxYear(info.getNearlyThree()).annualRevenue(info.getAnnualRevenueThree()).rdDeductible(info.getRdDeductibleThree()).build());
|
|
|
|
- tmpTaxInfos.add(TaxInfo.builder().taxYear(info.getNearlyTwo()).annualRevenue(info.getAnnualRevenueTwo()).rdDeductible(info.getRdDeductibleTwo()).build());
|
|
|
|
- tmpTaxInfos.add(TaxInfo.builder().taxYear(info.getNearlyOne()).annualRevenue(info.getAnnualRevenueOne()).rdDeductible(info.getRdDeductibleOne()).build());
|
|
|
|
- addTaxInfos.add(tmpTaxInfos);
|
|
|
|
-
|
|
|
|
- // 所属行业 需要单独处理,做一下转换后进行存储。
|
|
|
|
- addBasicInfo.setIndustry(categoryService.dealCategory(info.getIndustry(), true));
|
|
|
|
- // 企业类型:国有企业 集体所有制企业 私营企业 股份制企业 联营企业 外商投资企业 港澳台企业 股份合作企业 有限责任公司 其他企业。
|
|
|
|
- addBasicInfo.setEnterpriseType(categoryService.dealCategory(info.getEnterpriseType(), true));
|
|
|
|
- // 机构类型:企业 高校 机构 园区 政府 其他。
|
|
|
|
- addBasicInfo.setResType(categoryService.dealCategory(info.getResType(), true));
|
|
|
|
- // 研发机构等级:国家级、省级、市级、区级等。
|
|
|
|
- addBasicInfo.setDevOrgLevel(categoryService.dealCategory(info.getDevOrgLevel(), true));
|
|
|
|
- // 是否规上: 前端传0 否 或 1 是。
|
|
|
|
- // addBasicInfo.setIsGauge("");
|
|
|
|
- // 企业资质:国高、市高、省科技型中小企业、高企培育、规上、科技型初创企业、高新潜力企业、创新引领企业。
|
|
|
|
- addBasicInfo.setQualifyInfo(categoryService.dealCategory(info.getQualifyInfo(), true));
|
|
|
|
-
|
|
|
|
- // todo 需要保存企业信息,再处理人员信息。
|
|
|
|
-
|
|
|
|
- // todo 企业负责人/法人信息关联id,需要将联系人信息新增至人员信息表。同时应该配置至企业与人员信息关联关系表。
|
|
|
|
- addBasicInfo.setChargeDirectorId("");
|
|
|
|
- // 企业联系人
|
|
|
|
- addBasicInfo.setContactsId("");
|
|
|
|
- // 研发负责人信息关联id
|
|
|
|
- addBasicInfo.setResearchDevDirectorId("");
|
|
|
|
- // 财务负责人信息关联id
|
|
|
|
- addBasicInfo.setFinancialDirectorId("");
|
|
|
|
- // 科技联络人信息关联id
|
|
|
|
- addBasicInfo.setTechnicalDirectorId("");
|
|
|
|
- // todo 还要考虑到企业库的其他信息的录入,主要包含了高企管理相关录入信息。
|
|
|
|
- // 行业领域也由节点管理员进行配置。
|
|
|
|
- addedBasicInfos.add(addBasicInfo);
|
|
|
|
- }
|
|
|
|
- log.info("addedBasicInfos before:{}", JSON.toJSONString(addedBasicInfos));
|
|
|
|
- // 批量新增企业基本信息。
|
|
|
|
- boolean b = saveOrUpdateBatch(addedBasicInfos);
|
|
|
|
- log.info("save basic-org info res:{}", b);
|
|
|
|
- log.info("addedBasicInfos after:{}", JSON.toJSONString(addedBasicInfos));
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- List<EnterpriseOtherInfo> otherInfos = new ArrayList<>();
|
|
|
|
- List<TaxInfo> taxInfos = new ArrayList<>();
|
|
|
|
- // 处理各信息关联关系。
|
|
|
|
- for (int i = 0; i < addedBasicInfos.size(); i++) {
|
|
|
|
-
|
|
|
|
- // 建立企业与税务数据的关联关系。
|
|
|
|
- taxInfos = taxInfoService.dealTaxInfo(addTaxInfos.get(i), addedBasicInfos.get(i).getId());
|
|
|
|
-
|
|
|
|
- System.err.println("*****************orgId:" + addedBasicInfos.get(i).getId());
|
|
|
|
-
|
|
|
|
- // 1 企业联系人姓名及联系方式。
|
|
|
|
- String contactsName = basicInfos.get(i).getContacts();
|
|
|
|
- String contactsWay = basicInfos.get(i).getContactsWay();
|
|
|
|
- String s1 = "";
|
|
|
|
- if (StringUtils.isNotEmpty(contactsName) && StringUtils.isNotEmpty(contactsWay)) {
|
|
|
|
- s1 = personalInfoService.dealPersonal(contactsName, contactsWay, addedBasicInfos.get(i).getId(), "6", "1");
|
|
|
|
- addedBasicInfos.get(i).setContactsId(s1);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 2 企业负责人/法定代表人姓名及联系方式。
|
|
|
|
- String chargeDirectorName = basicInfos.get(i).getChargeDirectorName();
|
|
|
|
- String chargeDirectorWay = basicInfos.get(i).getChargeDirectorWay();
|
|
|
|
- String s2 = "";
|
|
|
|
- if (StringUtils.isNotEmpty(chargeDirectorName) && StringUtils.isNotEmpty(chargeDirectorWay)) {
|
|
|
|
- s2 = personalInfoService.dealPersonal(chargeDirectorName, chargeDirectorWay, addedBasicInfos.get(i).getId(), "6", "2");
|
|
|
|
- addedBasicInfos.get(i).setChargeDirectorId(s2);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 3 研发负责人姓名及联系方式。
|
|
|
|
- String researchDevName = basicInfos.get(i).getResearchDevName();
|
|
|
|
- String researchDevWay = basicInfos.get(i).getResearchDevWay();
|
|
|
|
- String s3 = "";
|
|
|
|
- if (StringUtils.isNotEmpty(researchDevName) && StringUtils.isNotEmpty(researchDevWay)) {
|
|
|
|
- s3 = personalInfoService.dealPersonal(researchDevName, researchDevWay, addedBasicInfos.get(i).getId(), "6", "3");
|
|
|
|
- addedBasicInfos.get(i).setResearchDevDirectorId(s3);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 4 财务负责人姓名及联系方式。
|
|
|
|
- String financialName = basicInfos.get(i).getFinancialName();
|
|
|
|
- String financialWay = basicInfos.get(i).getFinancialWay();
|
|
|
|
- String s4 = "";
|
|
|
|
- if (StringUtils.isNotEmpty(financialName) && StringUtils.isNotEmpty(financialWay)) {
|
|
|
|
- s4 = personalInfoService.dealPersonal(financialName, financialWay, addedBasicInfos.get(i).getId(), "6", "4");
|
|
|
|
- addedBasicInfos.get(i).setFinancialDirectorId(s4);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 5 科技联络人姓名及联系方式。
|
|
|
|
- String technicalName = basicInfos.get(i).getTechnicalName();
|
|
|
|
- String technicalWay = basicInfos.get(i).getTechnicalWay();
|
|
|
|
- String s5 = "";
|
|
|
|
- if (StringUtils.isNotEmpty(technicalName) && StringUtils.isNotEmpty(technicalWay)) {
|
|
|
|
- s5 = personalInfoService.dealPersonal(technicalName, technicalWay, addedBasicInfos.get(i).getId(), "6", "5");
|
|
|
|
- addedBasicInfos.get(i).setTechnicalDirectorId(s5);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- log.info("deal personal s1:{},s2:{},s3:{},s4:{},s5:{}", s1, s2, s3, s4, s5);
|
|
|
|
-
|
|
|
|
- // 企业其他信息待新增或更新。
|
|
|
|
- otherInfos.add(addOtherInfos.get(i).setEnterpriseId(addedBasicInfos.get(i).getId()));
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- log.info("update addedBasicInfos:{}", JSON.toJSONString(addedBasicInfos));
|
|
|
|
- // 新增或更新企业人员信息:
|
|
|
|
- boolean b1 = saveOrUpdateBatch(addedBasicInfos);
|
|
|
|
- log.info("update basic-info res:{}", b1);
|
|
|
|
- log.info("update basic-info:{}", JSON.toJSONString(addedBasicInfos));
|
|
|
|
-
|
|
|
|
- // 新增或更新企业税务数据。
|
|
|
|
- log.info("update addTaxInfos:{}", JSON.toJSONString(addTaxInfos));
|
|
|
|
- boolean b5 = taxInfoService.saveOrUpdateBatch(taxInfos);
|
|
|
|
- log.info("save-update tax-info res:{}",b5);
|
|
|
|
- log.info("update tax-info:{}", JSON.toJSONString(taxInfos));
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // 同步基本信息至资源库。
|
|
|
|
- List<ResourceLibrary> basicResourceLibraries = resourceLibraryService.dealBasicResourceLib(addedBasicInfos,taxInfos);
|
|
|
|
- boolean b3 = resourceLibraryService.saveOrUpdateBatch(basicResourceLibraries);
|
|
|
|
- log.info("save-or-update resourcelib-basic-data res:{}",b3);
|
|
|
|
-
|
|
|
|
- // 新增或更新企业库其他信息。
|
|
|
|
- log.info("update addOtherInfos:{}", JSON.toJSONString(otherInfos));
|
|
|
|
- // todo 根据企业id判断是否已存在数据,
|
|
|
|
- // 批量新增企业其他信息。
|
|
|
|
- boolean b2 = enterpriseOtherInfoService.dealOtherInfos(otherInfos);
|
|
|
|
- log.info("save other-info res:{}", b2);
|
|
|
|
- log.info("update other-info:{}", JSON.toJSONString(otherInfos));
|
|
|
|
-
|
|
|
|
- System.err.println("########################:" + otherInfos.get(0).getId());
|
|
|
|
-
|
|
|
|
- // 同步其他信息至资源库。
|
|
|
|
-
|
|
|
|
- List<ResourceLibrary> otherResourceLibraries = resourceLibraryService.dealOtherResourceLib(otherInfos);
|
|
|
|
- boolean b4 = resourceLibraryService.saveOrUpdateBatch(otherResourceLibraries);
|
|
|
|
- log.info("save-or-update resourcelib-other-data res:{}",b4);
|
|
|
|
-
|
|
|
|
- List<ResourceLibrary> resourceLibraries = new ArrayList<>();
|
|
|
|
- for (EnterpriseBasicInfo info : addedBasicInfos) {
|
|
|
|
- List<ResourceLibrary> resourceLibs = resourceLibraryService.selByUniqueId(info.getId());
|
|
|
|
- if (resourceLibs.size() > 0){
|
|
|
|
- resourceLibraries.add(resourceLibs.get(0));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 同步信息至es库。
|
|
|
|
- esService.saveResourceLibsToEs(resourceLibraries);
|
|
|
|
-
|
|
|
|
- return esService.selEsByName(addedBasicInfos.get(0).getName());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // public
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
IdentifierGenerator identifierGenerator=new DefaultIdentifierGenerator();
|
|
IdentifierGenerator identifierGenerator=new DefaultIdentifierGenerator();
|