Skip to content

Commit 385ab0d

Browse files
committedFeb 17, 2019
Initial commit
0 parents  commit 385ab0d

20 files changed

+754
-0
lines changed
 

‎INNCheck.iml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3+
<component name="FacetManager">
4+
<facet type="Spring" name="Spring">
5+
<configuration />
6+
</facet>
7+
<facet type="web" name="Web">
8+
<configuration>
9+
<webroots>
10+
<root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
11+
</webroots>
12+
<sourceRoots>
13+
<root url="file://$MODULE_DIR$/src/main/java" />
14+
<root url="file://$MODULE_DIR$/src/main/resources" />
15+
</sourceRoots>
16+
</configuration>
17+
</facet>
18+
</component>
19+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
20+
<output url="file://$MODULE_DIR$/target/classes" />
21+
<output-test url="file://$MODULE_DIR$/target/test-classes" />
22+
<content url="file://$MODULE_DIR$">
23+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
24+
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
25+
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
26+
<excludeFolder url="file://$MODULE_DIR$/target" />
27+
</content>
28+
<orderEntry type="inheritedJdk" />
29+
<orderEntry type="sourceFolder" forTests="false" />
30+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.0.5.RELEASE" level="project" />
31+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.5.RELEASE" level="project" />
32+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.0.5.RELEASE" level="project" />
33+
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
34+
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
35+
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
36+
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.10.0" level="project" />
37+
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.10.0" level="project" />
38+
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
39+
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
40+
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.9.RELEASE" level="project" />
41+
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.9.RELEASE" level="project" />
42+
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.19" level="project" />
43+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.0.5.RELEASE" level="project" />
44+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.6" level="project" />
45+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
46+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.6" level="project" />
47+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.6" level="project" />
48+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.6" level="project" />
49+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.6" level="project" />
50+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.0.5.RELEASE" level="project" />
51+
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.34" level="project" />
52+
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.34" level="project" />
53+
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.34" level="project" />
54+
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.12.Final" level="project" />
55+
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
56+
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
57+
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
58+
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.0.9.RELEASE" level="project" />
59+
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.9.RELEASE" level="project" />
60+
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.0.9.RELEASE" level="project" />
61+
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.0.9.RELEASE" level="project" />
62+
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.0.9.RELEASE" level="project" />
63+
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.0.9.RELEASE" level="project" />
64+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-devtools:2.0.5.RELEASE" level="project" />
65+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.5.RELEASE" level="project" />
66+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.0.5.RELEASE" level="project" />
67+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-mustache:2.0.5.RELEASE" level="project" />
68+
<orderEntry type="library" name="Maven: com.samskivert:jmustache:1.14" level="project" />
69+
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.6" level="project" />
70+
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.10" level="project" />
71+
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
72+
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.2" level="project" />
73+
<orderEntry type="library" name="Maven: org.jsoup:jsoup:1.11.3" level="project" />
74+
</component>
75+
</module>

‎pom.xml

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>INNCheck</groupId>
8+
<artifactId>INNCheck</artifactId>
9+
<version>1.0</version>
10+
<packaging>war</packaging>
11+
12+
<parent>
13+
<groupId>org.springframework.boot</groupId>
14+
<artifactId>spring-boot-starter-parent</artifactId>
15+
<version>2.0.5.RELEASE</version>
16+
</parent>
17+
18+
<dependencies>
19+
20+
<dependency>
21+
<groupId>org.springframework.boot</groupId>
22+
<artifactId>spring-boot-starter-web</artifactId>
23+
</dependency>
24+
<!-- Для генерации war-->
25+
<!--
26+
<dependency>
27+
<groupId>org.springframework.boot</groupId>
28+
<artifactId>spring-boot-starter-tomcat</artifactId>
29+
<scope>provided</scope>
30+
</dependency>
31+
-->
32+
<dependency>
33+
<groupId>org.springframework.boot</groupId>
34+
<artifactId>spring-boot-devtools</artifactId>
35+
<optional>true</optional>
36+
</dependency>
37+
38+
<dependency>
39+
<groupId>org.springframework.boot</groupId>
40+
<artifactId>spring-boot-starter-mustache</artifactId>
41+
</dependency>
42+
43+
<dependency>
44+
<groupId>org.apache.httpcomponents</groupId>
45+
<artifactId>httpclient</artifactId>
46+
<version>4.5.6</version>
47+
</dependency>
48+
49+
<dependency>
50+
<groupId>com.google.code.gson</groupId>
51+
<artifactId>gson</artifactId>
52+
<version>2.8.2</version>
53+
</dependency>
54+
55+
<dependency>
56+
<groupId>org.jsoup</groupId>
57+
<artifactId>jsoup</artifactId>
58+
<version>1.11.3</version>
59+
</dependency>
60+
61+
</dependencies>
62+
63+
<properties>
64+
<java.version>1.8</java.version>
65+
<start-class>innchkeckerpack.Application</start-class>
66+
</properties>
67+
68+
69+
<build>
70+
<plugins>
71+
<plugin>
72+
<groupId>org.springframework.boot</groupId>
73+
<artifactId>spring-boot-maven-plugin</artifactId>
74+
<configuration>
75+
<jvmArguments>-Dfile.encoding=UTF8</jvmArguments>
76+
</configuration>
77+
</plugin>
78+
79+
80+
</plugins>
81+
</build>
82+
83+
84+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package innchkeckerpack;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.boot.builder.SpringApplicationBuilder;
6+
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
7+
8+
@SpringBootApplication
9+
public class Application extends SpringBootServletInitializer {
10+
11+
@Override
12+
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
13+
return application.sources(Application.class);
14+
}
15+
16+
public static void main(String[] args) throws Exception {
17+
SpringApplication.run(Application.class, args);
18+
}
19+
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package innchkeckerpack.controller;
2+
3+
import innchkeckerpack.domain.Suggestions;
4+
import innchkeckerpack.service.OrganizationService;
5+
import org.springframework.stereotype.Controller;
6+
import org.springframework.web.bind.annotation.GetMapping;
7+
import org.springframework.web.bind.annotation.PostMapping;
8+
import org.springframework.web.bind.annotation.RequestParam;
9+
10+
import java.util.Map;
11+
12+
@Controller
13+
public class InnCheckController {
14+
15+
@GetMapping("/checking")
16+
public String checking(@RequestParam(name="inn", required=false, defaultValue="Результаты отсутствуют") String inn, Map<String, Object> model) {
17+
OrganizationService service = new OrganizationService();
18+
String upDate = service.gettingUpDate();
19+
model.put("upd", upDate);
20+
return "checking";
21+
}
22+
23+
@GetMapping("/")
24+
public String main(Map<String, Object> model)
25+
{
26+
OrganizationService service = new OrganizationService();
27+
String upDate = service.gettingUpDate();
28+
model.put("upd", upDate);
29+
30+
return "checking";
31+
}
32+
33+
@PostMapping
34+
public String find(@RequestParam String inn, Map<String, Object> model)
35+
{
36+
Suggestions suggestions = new Suggestions();
37+
OrganizationService service = new OrganizationService();
38+
suggestions = service.jsonParsing(service.sendingPost(inn.trim().replaceAll(" ", "").replaceAll("_", "").replaceAll("[a-zA-Zа-яА-Я]*", "")));
39+
model.put("organizations", suggestions.getSuggestions());
40+
String upDate = service.gettingUpDate();
41+
model.put("upd", upDate);
42+
//model.put("upd", service.gettingUpDate());
43+
44+
return "checking";
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package innchkeckerpack.domain;
2+
3+
public class Adress {
4+
private String value;
5+
private String unrestricted_value;
6+
private AdressData data;
7+
8+
public String getValue() {
9+
return value;
10+
}
11+
12+
public void setValue(String value) {
13+
this.value = value;
14+
}
15+
16+
public String getUnrestricted_value() {
17+
return unrestricted_value;
18+
}
19+
20+
public void setUnrestricted_value(String unrestricted_value) {
21+
this.unrestricted_value = unrestricted_value;
22+
}
23+
24+
public AdressData getData() {
25+
return data;
26+
}
27+
28+
public void setData(AdressData data) {
29+
this.data = data;
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package innchkeckerpack.domain;
2+
3+
public class AdressData {
4+
5+
private String postal_code;
6+
private String country;
7+
private String region_kladr_id;
8+
private String city_with_type;
9+
private String city_area;
10+
private String city_district_with_type;
11+
private String street_with_type;
12+
private String house_type_full;
13+
private String house;
14+
private String source;
15+
16+
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package innchkeckerpack.domain;
2+
3+
public class Management {
4+
5+
private String name;
6+
private String post;
7+
8+
public String getName() {
9+
return name;
10+
}
11+
12+
public void setName(String name) {
13+
this.name = name;
14+
}
15+
16+
public String getPost() {
17+
return post;
18+
}
19+
20+
public void setPost(String post) {
21+
this.post = post;
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package innchkeckerpack.domain;
2+
3+
public class Opf {
4+
5+
private String type;
6+
private String code;
7+
private String full;
8+
9+
public String getType() {
10+
return type;
11+
}
12+
13+
public void setType(String type) {
14+
this.type = type;
15+
}
16+
17+
public String getCode() {
18+
return code;
19+
}
20+
21+
public void setCode(String code) {
22+
this.code = code;
23+
}
24+
25+
public String getFull() {
26+
return full;
27+
}
28+
29+
public void setFull(String full) {
30+
this.full = full;
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
package innchkeckerpack.domain;
2+
3+
public class OrgData {
4+
5+
private String kpp;
6+
private String capital;
7+
private Management management;
8+
private String founders;
9+
private String managers;
10+
private Opf opf;
11+
private OrgName name;
12+
private String inn;
13+
private String ogrn;
14+
private String okpo;
15+
private String okved;
16+
private Adress address;
17+
private String phones;
18+
private String emails;
19+
private String ogrn_date;
20+
private String okved_type;
21+
22+
public String getKpp() {
23+
return kpp;
24+
}
25+
26+
public void setKpp(String kpp) {
27+
this.kpp = kpp;
28+
}
29+
30+
public String getCapital() {
31+
return capital;
32+
}
33+
34+
public void setCapital(String capital) {
35+
this.capital = capital;
36+
}
37+
38+
public Management getManagement() {
39+
return management;
40+
}
41+
42+
public void setManagement(Management management) {
43+
this.management = management;
44+
}
45+
46+
public String getFounders() {
47+
return founders;
48+
}
49+
50+
public void setFounders(String founders) {
51+
this.founders = founders;
52+
}
53+
54+
public String getManagers() {
55+
return managers;
56+
}
57+
58+
public void setManagers(String managers) {
59+
this.managers = managers;
60+
}
61+
62+
public Opf getOpf() {
63+
return opf;
64+
}
65+
66+
public void setOpf(Opf opf) {
67+
this.opf = opf;
68+
}
69+
70+
public OrgName getName() {
71+
return name;
72+
}
73+
74+
public void setName(OrgName name) {
75+
this.name = name;
76+
}
77+
78+
public String getInn() {
79+
return inn;
80+
}
81+
82+
public void setInn(String inn) {
83+
this.inn = inn;
84+
}
85+
86+
public String getOgrn() {
87+
return ogrn;
88+
}
89+
90+
public void setOgrn(String ogrn) {
91+
this.ogrn = ogrn;
92+
}
93+
94+
public String getOkpo() {
95+
return okpo;
96+
}
97+
98+
public void setOkpo(String okpo) {
99+
this.okpo = okpo;
100+
}
101+
102+
public String getOkved() {
103+
return okved;
104+
}
105+
106+
public void setOkved(String okved) {
107+
this.okved = okved;
108+
}
109+
110+
public Adress getAddress() {
111+
return address;
112+
}
113+
114+
public void setAddress(Adress address) {
115+
this.address = address;
116+
}
117+
118+
public String getPhones() {
119+
return phones;
120+
}
121+
122+
public void setPhones(String phones) {
123+
this.phones = phones;
124+
}
125+
126+
public String getEmails() {
127+
return emails;
128+
}
129+
130+
public void setEmails(String emails) {
131+
this.emails = emails;
132+
}
133+
134+
public String getOgrn_date() {
135+
return ogrn_date;
136+
}
137+
138+
public void setOgrn_date(String ogrn_date) {
139+
this.ogrn_date = ogrn_date;
140+
}
141+
142+
public String getOkved_type() {
143+
return okved_type;
144+
}
145+
146+
public void setOkved_type(String okved_type) {
147+
this.okved_type = okved_type;
148+
}
149+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package innchkeckerpack.domain;
2+
3+
public class OrgName {
4+
private String full_with_opf;
5+
private String short_with_opf;
6+
private String full;
7+
8+
public String getFull_with_opf() {
9+
return full_with_opf;
10+
}
11+
12+
public void setFull_with_opf(String full_with_opf) {
13+
this.full_with_opf = full_with_opf;
14+
}
15+
16+
public String getShort_with_opf() {
17+
return short_with_opf;
18+
}
19+
20+
public void setShort_with_opf(String short_with_opf) {
21+
this.short_with_opf = short_with_opf;
22+
}
23+
24+
public String getFull() {
25+
return full;
26+
}
27+
28+
public void setFull(String full) {
29+
this.full = full;
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package innchkeckerpack.domain;
2+
3+
public class Organization {
4+
5+
private String value;
6+
private String unrestricted_value;
7+
private OrgData data;
8+
9+
public String getValue() {
10+
return value;
11+
}
12+
13+
public void setValue(String value) {
14+
this.value = value;
15+
}
16+
17+
public String getUnrestricted_value() {
18+
return unrestricted_value;
19+
}
20+
21+
public void setUnrestricted_value(String unrestricted_value) {
22+
this.unrestricted_value = unrestricted_value;
23+
}
24+
25+
public OrgData getData() {
26+
return data;
27+
}
28+
29+
public void setData(OrgData data) {
30+
this.data = data;
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package innchkeckerpack.domain;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class Suggestions {
7+
List<Organization> suggestions = new ArrayList<>();
8+
9+
public List<Organization> getSuggestions() {
10+
return suggestions;
11+
}
12+
13+
public void setSuggestions(List<Organization> suggestions) {
14+
this.suggestions = suggestions;
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package innchkeckerpack.repos;
2+
3+
import innchkeckerpack.domain.Suggestions;
4+
5+
public interface OrganizationRepo {
6+
7+
String sendingPost(String inn);
8+
Suggestions jsonParsing(String postResultString);
9+
String gettingUpDate();
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
package innchkeckerpack.service;
2+
3+
import com.google.gson.Gson;
4+
import innchkeckerpack.domain.Organization;
5+
import innchkeckerpack.domain.Suggestions;
6+
import innchkeckerpack.repos.OrganizationRepo;
7+
import org.apache.http.HttpResponse;
8+
import org.apache.http.client.ClientProtocolException;
9+
import org.apache.http.client.HttpClient;
10+
import org.apache.http.client.methods.HttpPost;
11+
import org.apache.http.entity.ContentType;
12+
import org.apache.http.entity.StringEntity;
13+
import org.apache.http.impl.client.DefaultHttpClient;
14+
import org.jsoup.Jsoup;
15+
import org.jsoup.nodes.Document;
16+
17+
import java.io.BufferedReader;
18+
import java.io.IOException;
19+
import java.io.InputStreamReader;
20+
import java.io.UnsupportedEncodingException;
21+
import java.util.HashMap;
22+
import java.util.Map;
23+
24+
public class OrganizationService implements OrganizationRepo {
25+
26+
private final String USER_AGENT = "Mozilla/5.0";
27+
private final String URL = "https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/party";
28+
private String postResultString;
29+
30+
@Override
31+
public String sendingPost(String inn) {
32+
33+
34+
HttpClient client = new DefaultHttpClient();
35+
HttpPost post = new HttpPost(URL);
36+
37+
post.setHeader("User-Agent", USER_AGENT);
38+
post.setHeader("Content-Type", "application/json");
39+
post.setHeader("Accept", "application/json");
40+
post.setHeader("Authorization", "Token 3312ffbd375be3421d41e78a7a8e414f2bce1d6c");
41+
HttpResponse response = null;
42+
try {
43+
//StringEntity requestEntity = new StringEntity("{ \"query\": \"сбербанк\" }", ContentType.APPLICATION_JSON);post.setEntity(requestEntity); // По имени организации
44+
post.setEntity(new StringEntity("{ \"query\": \"" + inn + "\" }", ContentType.create("application/json")));
45+
response = client.execute(post);
46+
System.out.println("\nSending 'POST' request to URL : " + URL);
47+
System.out.println("Post parameters : " + post.getEntity());
48+
System.out.println("Response Code : " +
49+
response.getStatusLine().getStatusCode());
50+
51+
} catch (ClientProtocolException e) {
52+
e.printStackTrace();
53+
} catch (IOException e) {
54+
e.printStackTrace();
55+
}
56+
57+
58+
try {
59+
BufferedReader rd = new BufferedReader(
60+
new InputStreamReader(response.getEntity().getContent(), "UTF8"));
61+
62+
StringBuffer result = new StringBuffer();
63+
String line = "";
64+
while ((line = rd.readLine()) != null) {
65+
result.append(line);
66+
}
67+
postResultString = result.toString();
68+
69+
} catch (IOException e) {
70+
e.printStackTrace();
71+
}
72+
73+
74+
return postResultString;
75+
}
76+
77+
@Override
78+
public Suggestions jsonParsing(String postResultString) {
79+
Gson g = new Gson();
80+
Suggestions suggestions = g.fromJson(postResultString.toString(), Suggestions.class);
81+
82+
for (Organization organization : suggestions.getSuggestions())
83+
{
84+
organization.setValue(organization.getValue() != null ? organization.getValue() : "Не указано");
85+
organization.setUnrestricted_value(organization.getUnrestricted_value() != null ? organization.getUnrestricted_value() : "Не указано");
86+
//organization.getData().setCapital(organization.getData().getCapital() != null ? toUTF(organization.getData().getCapital()) : "Не указано");
87+
// organization.getData().setFounders(organization.getData().getFounders() != null ? toUTF(organization.getData().getFounders()) : "Не указано");
88+
organization.getData().setInn(organization.getData().getInn() != null ? organization.getData().getInn() : "Не указано");
89+
organization.getData().setKpp(organization.getData().getKpp() != null ? organization.getData().getKpp() : "Не указано");
90+
organization.getData().setOgrn(organization.getData().getOgrn() != null ? organization.getData().getOgrn() : "Не указано");
91+
organization.getData().setOkpo(organization.getData().getOkpo() != null ? organization.getData().getOkpo() : "Не указано");
92+
organization.getData().setOkved(organization.getData().getOkved() != null ? organization.getData().getOkved() : "Не указано");
93+
// organization.getData().setManagers(organization.getData().getManagers() != null ? toUTF(organization.getData().getManagers()) : "Не указано");
94+
//organization.getData().setPhones(organization.getData().getPhones() != null ? toUTF(organization.getData().getPhones()) : "Не указано");
95+
//organization.getData().setEmails(organization.getData().getEmails() != null ? toUTF(organization.getData().getEmails()) : "Не указано");
96+
//organization.getData().getManagement().setName(organization.getData().getManagement().getName() != null ? toUTF(organization.getData().getManagement().getName()) : "Не указано");
97+
// organization.getData().getManagement().setPost(organization.getData().getManagement().getPost() != null ? toUTF(organization.getData().getManagement().getPost()) : "Не указано");
98+
organization.getData().getOpf().setType(organization.getData().getOpf().getType() != null ? organization.getData().getOpf().getType() : "Не указано");
99+
organization.getData().getOpf().setFull(organization.getData().getOpf().getFull() != null ? organization.getData().getOpf().getFull() : "Не указано");
100+
organization.getData().getName().setFull(organization.getData().getName().getFull() != null ? organization.getData().getName().getFull() : "Не указано");
101+
organization.getData().getName().setFull_with_opf(organization.getData().getName().getFull_with_opf() != null ? organization.getData().getName().getFull_with_opf() : "Не указано");
102+
organization.getData().getName().setShort_with_opf(organization.getData().getName().getShort_with_opf() != null ? organization.getData().getName().getShort_with_opf() : "Не указано");
103+
organization.getData().getAddress().setValue(organization.getData().getAddress().getValue() != null ? organization.getData().getAddress().getValue() : "Не указано");
104+
105+
}
106+
107+
return suggestions;
108+
}
109+
110+
@Override
111+
public String gettingUpDate() {
112+
Document html = null;
113+
114+
115+
try {
116+
html = Jsoup.connect("https://dadata.ru/clean/").get();
117+
} catch (IOException e) {
118+
e.printStackTrace();
119+
}
120+
121+
String[] servNames = html.body().getElementsByClass("col-xs-7").text().split(" ");
122+
String[] servUpdates = html.body().getElementsByClass("col-xs-5").text().split(" ");
123+
Map<String, String> dictionares = new HashMap<>();
124+
125+
System.out.println(servUpdates[3]);
126+
return servUpdates[3];
127+
}
128+
129+
130+
131+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
spring.mustache.expose-request-attributes=true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<title>Поиск по ИНН</title>
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6+
<link rel="shortcut icon" href="images/Greenatom.ico" type="image/x-icon">
7+
</head>
8+
<body>
9+
<br>
10+
<br>
11+
<div>
12+
<img src="D:\INNCheck\src\main\resources\templates\images\CC_logo.png" width="450" height="230" alt="no"/>
13+
</div>
14+
<br>
15+
<br>
16+
<div><h2><font face="Times New Roman" color="black">Проверка организаций</font></h2></div>
17+
<br>
18+
Последнее обновление базы: {{upd}}
19+
<br>
20+
<br>
21+
<form method="post">
22+
<input type="text" name="inn" placeholder="ИНН">
23+
<button type="submit">Проверить</button>
24+
</form>
25+
26+
27+
<br>
28+
<br>
29+
{{#organizations}}
30+
<div>
31+
<b>Наименование организации: {{value}}</b><br>
32+
<b>Полное наименование организации: {{data.name.full_with_opf}}</b><br>
33+
<b>Краткое наименование организации: {{data.name.short_with_opf}}</b><br>
34+
<b>Форма собственности: {{data.opf.full}}</b><br>
35+
<b>ИНН: {{data.inn}}</b><br>
36+
<b>ОГРН: {{data.ogrn}}</b><br>
37+
<b>КПП: {{data.kpp}}</b><br>
38+
<b>ОКПО: {{data.okpo}}</b><br>
39+
<b>ОКВЕД: {{data.okved}}</b><br>
40+
<b>Адрес: {{data.address.value}}</b><br>
41+
<b>Индекс: {{data.address.data.postal_code}}</b><br>
42+
<br><br>
43+
44+
45+
</div>
46+
{{/organizations}}
47+
<br>
48+
<br>
49+
<br>
50+
51+
<a href="javascript:scroll(0,0)" > В начало </a>
52+
</body>
53+
</html>
54+
55+
56+
30.4 KB
Loading
Binary file not shown.
Loading
24.3 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.