|
@@ -10,6 +10,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
import com.ruoyi.web.controller.tool.HttpUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -97,63 +98,52 @@ public class TEnterpriseInformationController extends BaseController {
|
|
|
public AjaxResult getBasicInfo(@RequestParam(value = "keyword") String keyword) throws Exception {
|
|
|
TEnterpriseInformation tEnterpriseInformation = tEnterpriseInformationService.selectTEnterpriseInformation(keyword);
|
|
|
if (tEnterpriseInformation != null) {
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
if (ObjectUtil.isNotNull(tEnterpriseInformation.getBranches())) {
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
tEnterpriseInformation.setBranchesList(mapper.readValue(tEnterpriseInformation.getBranches(),
|
|
|
mapper.getTypeFactory().constructCollectionType(List.class, Map.class)));
|
|
|
}
|
|
|
if (ObjectUtil.isNotNull(tEnterpriseInformation.getPartners())) {
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
tEnterpriseInformation.setPartnersList(mapper.readValue(tEnterpriseInformation.getPartners(),
|
|
|
mapper.getTypeFactory().constructCollectionType(List.class, Map.class)));
|
|
|
}
|
|
|
if (ObjectUtil.isNotNull(tEnterpriseInformation.getEmployees())) {
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
tEnterpriseInformation.setEmployeesList(mapper.readValue(tEnterpriseInformation.getEmployees(),
|
|
|
mapper.getTypeFactory().constructCollectionType(List.class, Map.class)));
|
|
|
}
|
|
|
if (ObjectUtil.isNotNull(tEnterpriseInformation.getChangerecords())) {
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
tEnterpriseInformation.setChangerecordsList(mapper.readValue(tEnterpriseInformation.getChangerecords(),
|
|
|
mapper.getTypeFactory().constructCollectionType(List.class, Map.class)));
|
|
|
}
|
|
|
if (ObjectUtil.isNotNull(tEnterpriseInformation.getAbnormalItems())) {
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
tEnterpriseInformation.setAbnormalItemsList(mapper.readValue(tEnterpriseInformation.getAbnormalItems(),
|
|
|
mapper.getTypeFactory().constructCollectionType(List.class, Map.class)));
|
|
|
}
|
|
|
if (ObjectUtil.isNotNull(tEnterpriseInformation.getWebsites())) {
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
tEnterpriseInformation.setWebsitesList(mapper.readValue(tEnterpriseInformation.getWebsites(),
|
|
|
mapper.getTypeFactory().constructCollectionType(List.class, Map.class)));
|
|
|
}
|
|
|
if (ObjectUtil.isNotNull(tEnterpriseInformation.getContact())) {
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
tEnterpriseInformation.setContactMap(mapper.readValue(tEnterpriseInformation.getContact(), Map.class));
|
|
|
}
|
|
|
if (ObjectUtil.isNotNull(tEnterpriseInformation.getIndustryCode())) {
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
tEnterpriseInformation.setIndustryCodeMap(mapper.readValue(tEnterpriseInformation.getIndustryCode(), Map.class));
|
|
|
}
|
|
|
if (ObjectUtil.isNotNull(tEnterpriseInformation.getDomains())) {
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
tEnterpriseInformation.setDomainsList(mapper.readValue(tEnterpriseInformation.getDomains(),
|
|
|
mapper.getTypeFactory().constructCollectionType(List.class, String.class)));
|
|
|
}
|
|
|
if (ObjectUtil.isNotNull(tEnterpriseInformation.getQuotedType())) {
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
tEnterpriseInformation.setQuotedTypeList(mapper.readValue(tEnterpriseInformation.getQuotedType(),
|
|
|
mapper.getTypeFactory().constructCollectionType(List.class, String.class)));
|
|
|
}
|
|
|
return AjaxResult.success(tEnterpriseInformation);
|
|
|
- } else {
|
|
|
- TEnterpriseInformation tEnterpriseInformationNew = HttpUtils.getDetailAndContactByName(keyword);
|
|
|
- if (tEnterpriseInformationNew != null) {
|
|
|
- tEnterpriseInformationService.insertTEnterpriseInformation(tEnterpriseInformationNew);
|
|
|
- return AjaxResult.success(tEnterpriseInformationNew);
|
|
|
- } else {
|
|
|
- return AjaxResult.error("获取公司数据失败");
|
|
|
- }
|
|
|
}
|
|
|
+ TEnterpriseInformation tEnterpriseInformationNew = HttpUtils.getDetailAndContactByName(keyword);
|
|
|
+ if (ObjectUtils.isEmpty(tEnterpriseInformationNew)) {
|
|
|
+ return AjaxResult.error("获取公司数据失败");
|
|
|
+ }
|
|
|
+ tEnterpriseInformationService.insertTEnterpriseInformation(tEnterpriseInformationNew);
|
|
|
+ return AjaxResult.success(tEnterpriseInformationNew);
|
|
|
}
|
|
|
}
|