Compare commits
	
		
			14 Commits
		
	
	
		
			main
			...
			feature-ma
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| bbe1ee44c1 | |||
| 78c7a0d9a9 | |||
| 74e038dd56 | |||
| 56fb6b6b10 | |||
| ede811fa02 | |||
| 7160a58245 | |||
| 5a3b118f02 | |||
| 7ef2d1eb7a | |||
| 91f9b6dd92 | |||
| 2c82a2c8a3 | |||
| 805f6985cb | |||
| 9aedc877bb | |||
| dce9bfd3ea | |||
| dc81a17b9c | 
							
								
								
									
										87
									
								
								code/backend/NewCitizenIdentify/.vscode/fileheader.template.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								code/backend/NewCitizenIdentify/.vscode/fileheader.template.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,87 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2025-03-16 00:35:09
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /cpicxim-huixiabao/.vscode/fileheader.template.js
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2023} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
/**
 | 
			
		||||
 * This file is generated by VSCode extension: Fileheader Pro
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * These comments can help you write your own template with type hint
 | 
			
		||||
 * @typedef {Object} FileheaderVariable  Fileheader variables
 | 
			
		||||
 * @property {string} birthtime file birth time. will get it from VCS or fallback to filesystem when it is not available
 | 
			
		||||
 * @property {string} mtime file modification time. will get it from VCS or fallback to filesystem when it is not available
 | 
			
		||||
 * @property {string} authorName if the file is tracked by VCS, it will get the author name from VCS. else it will get it from current user name
 | 
			
		||||
 * @property {string} authorEmail if the file is tracked by VCS, it will get the author email from VCS. else it will get it from current user email
 | 
			
		||||
 * @property {string} userName else it will get it from current user name
 | 
			
		||||
 * @property {string} userEmail  user email is from VSCode config, and fallback to VCS config
 | 
			
		||||
 * @property {string} companyName
 | 
			
		||||
 * @property {string} projectName name of current project
 | 
			
		||||
 * @property {string} filePath the file path, relative to project root with POSIX path separator
 | 
			
		||||
 * @property {string} dirPath the directory path, relative to project root with POSIX path separator
 | 
			
		||||
 * @property {string} fileName filename with extension
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
 /**
 | 
			
		||||
 * @typedef {string | number | null | undefined | Template | boolean} TemplateInterpolation NOTE: boolean or falsy value will render empty string
 | 
			
		||||
 * 
 | 
			
		||||
 * @typedef {{ strings: TemplateStringsArray; interpolations: TemplateInterpolation[]; }} Template
 | 
			
		||||
 * @typedef {(strings: TemplateStringsArray, ...values: any[]) => string} ITemplateFunction
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Please confirm your provider extends from globalThis.FileheaderLanguageProvider
 | 
			
		||||
 */
 | 
			
		||||
class CustomLanguageProvider extends globalThis.FileheaderLanguageProvider {
 | 
			
		||||
  /**
 | 
			
		||||
   * @type {string[]}
 | 
			
		||||
   */
 | 
			
		||||
  languages = [
 | 
			
		||||
    "java",
 | 
			
		||||
    "javascript",
 | 
			
		||||
    "typescript",
 | 
			
		||||
    "javascriptreact",
 | 
			
		||||
    "typescriptreact",
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @type {string=} the language block comment start string.
 | 
			
		||||
   * this is for future feature: support detect old custom template when custom template changes
 | 
			
		||||
   */
 | 
			
		||||
  blockCommentStart = "/**";
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * @type {string=}
 | 
			
		||||
   */
 | 
			
		||||
  blockCommentEnd = "*/";
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * get your template when document language matched
 | 
			
		||||
   * @param {ITemplateFunction} tpl template function, it is a tagged function, support nested interpolation
 | 
			
		||||
   * @param {FileheaderVariable} variables template variables
 | 
			
		||||
   * @returns {Template}
 | 
			
		||||
   */
 | 
			
		||||
  getTemplate(tpl, variables) {
 | 
			
		||||
    // prettier-ignore
 | 
			
		||||
    return tpl
 | 
			
		||||
`/**
 | 
			
		||||
 * @Author: ${variables.authorName} <${variables.authorEmail}>
 | 
			
		||||
 * @Date: ${variables.birthtime}
 | 
			
		||||
 * @LastEditors: ${variables.userName}
 | 
			
		||||
 * @LastModified: ${variables.mtime}
 | 
			
		||||
 * @FilePath: ${variables.filePath}
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * 
 | 
			
		||||
 *               Copyright (c) ${2025} by Kane All rights reserved
 | 
			
		||||
 */`;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// export your provider classes
 | 
			
		||||
module.exports = [CustomLanguageProvider];
 | 
			
		||||
							
								
								
									
										4
									
								
								code/backend/NewCitizenIdentify/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								code/backend/NewCitizenIdentify/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
    "java.configuration.updateBuildConfiguration": "automatic",
 | 
			
		||||
    "java.compile.nullAnalysis.mode": "automatic"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										173
									
								
								code/backend/NewCitizenIdentify/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										173
									
								
								code/backend/NewCitizenIdentify/pom.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,173 @@
 | 
			
		||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
 | 
			
		||||
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
			
		||||
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 | 
			
		||||
  <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
  <groupId>com.cpic.xim</groupId>
 | 
			
		||||
  <artifactId>NewCitizen</artifactId>
 | 
			
		||||
  <packaging>war</packaging>
 | 
			
		||||
  <version>1.0-SNAPSHOT</version>
 | 
			
		||||
  <name>desktop_archievement_backend Maven Webapp</name>
 | 
			
		||||
  <url>http://maven.apache.org</url>
 | 
			
		||||
 | 
			
		||||
  <properties>
 | 
			
		||||
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
			
		||||
    <maven.compiler.source>8</maven.compiler.source>
 | 
			
		||||
    <maven.compiler.target>8</maven.compiler.target>
 | 
			
		||||
    <spring.version>6.2.4</spring.version>
 | 
			
		||||
    <log4j.version>2.24.3</log4j.version>
 | 
			
		||||
    <jackson.version>2.18.3</jackson.version>
 | 
			
		||||
    <!-- <spring.version>6.0.8</spring.version> -->
 | 
			
		||||
  </properties>
 | 
			
		||||
 | 
			
		||||
  <dependencies>
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.slf4j</groupId>
 | 
			
		||||
      <artifactId>slf4j-simple</artifactId>
 | 
			
		||||
      <version>2.0.17</version>
 | 
			
		||||
      <scope>test</scope>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>junit</groupId>
 | 
			
		||||
      <artifactId>junit</artifactId>
 | 
			
		||||
      <version>4.13.2</version>
 | 
			
		||||
      <scope>test</scope>
 | 
			
		||||
    </dependency>
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.springframework</groupId>
 | 
			
		||||
      <artifactId>spring-context</artifactId>
 | 
			
		||||
      <version>${spring.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.springframework</groupId>
 | 
			
		||||
      <artifactId>spring-test</artifactId>
 | 
			
		||||
      <version>${spring.version}</version>
 | 
			
		||||
      <scope>test</scope>
 | 
			
		||||
    </dependency>
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.springframework</groupId>
 | 
			
		||||
      <artifactId>spring-web</artifactId>
 | 
			
		||||
      <version>${spring.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.springframework</groupId>
 | 
			
		||||
      <artifactId>spring-webmvc</artifactId>
 | 
			
		||||
      <version>${spring.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <!-- <dependency>
 | 
			
		||||
      <groupId>javax.servlet</groupId>
 | 
			
		||||
      <artifactId>javax.servlet-api</artifactId>
 | 
			
		||||
      <version>4.0.1</version>
 | 
			
		||||
      <scope>provided</scope>
 | 
			
		||||
    </dependency> -->
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>jakarta.servlet</groupId>
 | 
			
		||||
      <artifactId>jakarta.servlet-api</artifactId>
 | 
			
		||||
      <version>6.1.0</version>
 | 
			
		||||
      <scope>provided</scope>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <!-- log4j -->
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.logging.log4j</groupId>
 | 
			
		||||
      <artifactId>log4j-core</artifactId>
 | 
			
		||||
      <version>${log4j.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.logging.log4j</groupId>
 | 
			
		||||
      <artifactId>log4j-slf4j2-impl</artifactId>
 | 
			
		||||
      <version>${log4j.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.logging.log4j</groupId>
 | 
			
		||||
      <artifactId>log4j-api</artifactId>
 | 
			
		||||
      <version>${log4j.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.directory.studio</groupId>
 | 
			
		||||
      <artifactId>org.apache.commons.codec</artifactId>
 | 
			
		||||
      <version>1.8</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <!-- jackson -->
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>com.fasterxml.jackson.core</groupId>
 | 
			
		||||
      <artifactId>jackson-databind</artifactId>
 | 
			
		||||
      <version>${jackson.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>com.fasterxml.jackson.core</groupId>
 | 
			
		||||
      <artifactId>jackson-core</artifactId>
 | 
			
		||||
      <version>${jackson.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>com.fasterxml.jackson.core</groupId>
 | 
			
		||||
      <artifactId>jackson-annotations</artifactId>
 | 
			
		||||
      <version>${jackson.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>com.mysql</groupId>
 | 
			
		||||
      <artifactId>mysql-connector-j</artifactId>
 | 
			
		||||
      <version>9.2.0</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.shiro</groupId>
 | 
			
		||||
      <artifactId>shiro-all</artifactId>
 | 
			
		||||
      <version>1.11.0</version>
 | 
			
		||||
      <type>pom</type>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.httpcomponents</groupId>
 | 
			
		||||
      <artifactId>httpclient</artifactId>
 | 
			
		||||
      <version>4.5.14</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.httpcomponents</groupId>
 | 
			
		||||
      <artifactId>httpcore</artifactId>
 | 
			
		||||
      <version>4.4.5</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.commons</groupId>
 | 
			
		||||
      <artifactId>commons-lang3</artifactId>
 | 
			
		||||
      <version>3.7</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
  </dependencies>
 | 
			
		||||
  <build>
 | 
			
		||||
    <finalName>NewCitizen</finalName>
 | 
			
		||||
    <plugins>
 | 
			
		||||
      <plugin>
 | 
			
		||||
        <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
        <artifactId>maven-war-plugin</artifactId>
 | 
			
		||||
        <version>3.2.2</version>
 | 
			
		||||
      </plugin>
 | 
			
		||||
      <plugin>
 | 
			
		||||
        <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
        <artifactId>maven-surefire-plugin</artifactId>
 | 
			
		||||
        <version>3.0.0-M6</version>
 | 
			
		||||
        <configuration>
 | 
			
		||||
          <skipTests>true</skipTests>
 | 
			
		||||
        </configuration>
 | 
			
		||||
      </plugin>
 | 
			
		||||
      <plugin>
 | 
			
		||||
        <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
        <artifactId>maven-compiler-plugin</artifactId>
 | 
			
		||||
        <version>3.8.1</version>
 | 
			
		||||
        <configuration>
 | 
			
		||||
          <source>8</source>
 | 
			
		||||
          <target>8</target>
 | 
			
		||||
          <encoding>UTF-8</encoding>
 | 
			
		||||
        </configuration>
 | 
			
		||||
      </plugin>
 | 
			
		||||
    </plugins>
 | 
			
		||||
  </build>
 | 
			
		||||
</project>
 | 
			
		||||
@@ -0,0 +1,27 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: Kane Wang <wangkane@qq.com>
 | 
			
		||||
 * @Date: 2023-05-26 18:40:36
 | 
			
		||||
 * @LastEditors: Kane Wang
 | 
			
		||||
 * @LastModified: 2025-05-07 22:02:07
 | 
			
		||||
 * @FilePath: src/main/java/com/cpic/xim/utils/config/EncryptionParameters.java
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * 
 | 
			
		||||
 *               Copyright (c) 2025 by Kane All rights reserved
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.utils.config;
 | 
			
		||||
 | 
			
		||||
public class EncryptionParameters
 | 
			
		||||
{
 | 
			
		||||
    private static String SECRET_KEY = "9ILpXKFSHckH1g7h";
 | 
			
		||||
    private static String KEY = "2d716d5c7b35d5c0d41199eb0fd789ca";
 | 
			
		||||
 | 
			
		||||
    public static String getSecretKey()
 | 
			
		||||
    {
 | 
			
		||||
        return EncryptionParameters.SECRET_KEY;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static String getKey()
 | 
			
		||||
    {
 | 
			
		||||
        return EncryptionParameters.KEY;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,65 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: Kane Wang <wangkane@qq.com>
 | 
			
		||||
 * @Date: 2024-04-29 11:09:50
 | 
			
		||||
 * @LastEditors: Kane Wang
 | 
			
		||||
 * @LastModified: 2025-05-07 22:04:08
 | 
			
		||||
 * @FilePath: src/main/java/com/cpic/xim/utils/http/HttpUtils.java
 | 
			
		||||
 * @Description: 用于http的相关工具方法
 | 
			
		||||
 * 
 | 
			
		||||
 *               Copyright (c) 2025 by Kane All rights reserved
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.utils.http;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import org.apache.http.HttpEntity;
 | 
			
		||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
 | 
			
		||||
import org.apache.http.client.methods.CloseableHttpResponse;
 | 
			
		||||
import org.apache.http.client.methods.HttpPost;
 | 
			
		||||
import org.apache.http.impl.client.CloseableHttpClient;
 | 
			
		||||
import org.apache.http.impl.client.HttpClients;
 | 
			
		||||
import org.apache.http.message.BasicNameValuePair;
 | 
			
		||||
import org.apache.http.util.EntityUtils;
 | 
			
		||||
 | 
			
		||||
public class HttpUtils
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * 
 | 
			
		||||
     * @param url
 | 
			
		||||
     * @param bodyMap
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public static String sendPost( String url, Map<String, String> bodyMap )
 | 
			
		||||
    {
 | 
			
		||||
        HttpPost post = new HttpPost( url );
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            // 创建参数集合
 | 
			
		||||
            List<BasicNameValuePair> list = new ArrayList<>();
 | 
			
		||||
            // 添加参数
 | 
			
		||||
            if ( bodyMap != null )
 | 
			
		||||
            {
 | 
			
		||||
                for ( String str : bodyMap.keySet() )
 | 
			
		||||
                {
 | 
			
		||||
                    list.add( new BasicNameValuePair( str, bodyMap.get( str ) ) );
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            // 把参数放入请求对象,post发送的参数list,指定格式
 | 
			
		||||
            post.setEntity( new UrlEncodedFormEntity( list, "UTF-8" ) );
 | 
			
		||||
            CloseableHttpClient client = HttpClients.createDefault();
 | 
			
		||||
            // 启动执行请求,并获得返回值
 | 
			
		||||
            CloseableHttpResponse response = client.execute( post );
 | 
			
		||||
            // 得到返回的entity对象
 | 
			
		||||
            HttpEntity entity = response.getEntity();
 | 
			
		||||
            // 把实体对象转换为string
 | 
			
		||||
            return EntityUtils.toString( entity, "UTF-8" );
 | 
			
		||||
        }
 | 
			
		||||
        catch ( Exception e1 )
 | 
			
		||||
        {
 | 
			
		||||
            e1.printStackTrace();
 | 
			
		||||
            return "";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,48 @@
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.utils.newcitizen;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class IdentifyResult
 | 
			
		||||
{
 | 
			
		||||
    public IdentifyResult() {}
 | 
			
		||||
    
 | 
			
		||||
    public String getCitizenType()
 | 
			
		||||
    {
 | 
			
		||||
        return citizenType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCitizenType( String citizenType )
 | 
			
		||||
    {
 | 
			
		||||
        this.citizenType = citizenType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getExpireDate()
 | 
			
		||||
    {
 | 
			
		||||
        return expireDate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setExpireDate( String expireDate )
 | 
			
		||||
    {
 | 
			
		||||
        this.expireDate = expireDate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getScore()
 | 
			
		||||
    {
 | 
			
		||||
        return score;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setScore( String score )
 | 
			
		||||
    {
 | 
			
		||||
        this.score = score;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("citizentype")
 | 
			
		||||
    private String citizenType;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("expiredate")
 | 
			
		||||
    private String expireDate;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("score")
 | 
			
		||||
    private String score;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,139 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: Kane Wang <wangkane@qq.com>
 | 
			
		||||
 * @Date: 2023-05-26 18:40:36
 | 
			
		||||
 * @LastEditors: Kane Wang
 | 
			
		||||
 * @LastModified: 2025-05-08 18:55:36
 | 
			
		||||
 * @FilePath: src/main/java/com/cpic/xim/utils/newcitizen/NewCitizenUitls.java
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * 
 | 
			
		||||
 *               Copyright (c) 2025 by Kane All rights reserved
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.utils.newcitizen;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.cpic.xim.utils.config.EncryptionParameters;
 | 
			
		||||
import com.cpic.xim.utils.http.HttpUtils;
 | 
			
		||||
import com.cpic.xim.utils.security.decode.DecryptionUtils;
 | 
			
		||||
import com.cpic.xim.utils.security.encode.EncryptionUtils;
 | 
			
		||||
import com.cpic.xim.utils.security.sign.SignUtils;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
import com.fasterxml.jackson.databind.ObjectMapper;
 | 
			
		||||
 | 
			
		||||
public class NewCitizenUitls
 | 
			
		||||
{
 | 
			
		||||
    // 请求地址
 | 
			
		||||
    private static String identifyURL = "https://api.xmcic.cn:8443/government/economic/352";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新市民验证
 | 
			
		||||
     * 
 | 
			
		||||
     * @param idCardNo 身份证号码
 | 
			
		||||
     * @param name     姓名
 | 
			
		||||
     * @return
 | 
			
		||||
     * @throws Exception
 | 
			
		||||
     */
 | 
			
		||||
    public static IdentifyResult identifyNewCitizen( String idCardNo, String name )
 | 
			
		||||
                                                                                    throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        String secretKey = EncryptionParameters.getSecretKey();
 | 
			
		||||
        String key       = EncryptionParameters.getKey();
 | 
			
		||||
        String pushURL   = "http://222.76.244.118:11101/NewCitizen/save_score.do";
 | 
			
		||||
 | 
			
		||||
        Map<String, String> param = new HashMap<String, String>();
 | 
			
		||||
 | 
			
		||||
        param.put( "authorized", EncryptionUtils.aesEncrypt( "1", secretKey ) );
 | 
			
		||||
        param.put( "idcard", EncryptionUtils.aesEncrypt( idCardNo, secretKey ) );
 | 
			
		||||
        param.put( "name", EncryptionUtils.aesEncrypt( name, secretKey ) );
 | 
			
		||||
        param.put( "pushurl", EncryptionUtils.aesEncrypt( pushURL, secretKey ) );
 | 
			
		||||
        param.put( "timestamp",
 | 
			
		||||
                   EncryptionUtils.aesEncrypt( System.currentTimeMillis() + "", secretKey ) );
 | 
			
		||||
 | 
			
		||||
        String              sign   = SignUtils.sign( param );
 | 
			
		||||
        Map<String, String> params = new HashMap<>();
 | 
			
		||||
 | 
			
		||||
        params.putAll( param );
 | 
			
		||||
        params.put( "key", key );
 | 
			
		||||
        params.put( "sign", sign );
 | 
			
		||||
 | 
			
		||||
        String         resultJSON     = HttpUtils.sendPost( identifyURL, params );
 | 
			
		||||
        ObjectMapper   mapper         = new ObjectMapper();
 | 
			
		||||
        IdentifyResult identifyResult = null;
 | 
			
		||||
        ResponseResult response       = null;
 | 
			
		||||
 | 
			
		||||
        response = mapper.readValue( resultJSON, ResponseResult.class );
 | 
			
		||||
 | 
			
		||||
        // 请求结果解密,应为一个json
 | 
			
		||||
        // 如果请求参数有误,data为null
 | 
			
		||||
        String identifyJSON = DecryptionUtils.aesDecrypt( response.getData(), secretKey );
 | 
			
		||||
 | 
			
		||||
        if ( identifyJSON != null )
 | 
			
		||||
        {
 | 
			
		||||
            identifyResult = mapper.readValue( identifyJSON, IdentifyResult.class );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return identifyResult;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ResponseResult
 | 
			
		||||
{
 | 
			
		||||
    public ResponseResult()
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getCode()
 | 
			
		||||
    {
 | 
			
		||||
        return code;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCode( String code )
 | 
			
		||||
    {
 | 
			
		||||
        this.code = code;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getMessage()
 | 
			
		||||
    {
 | 
			
		||||
        return message;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setMessage( String message )
 | 
			
		||||
    {
 | 
			
		||||
        this.message = message;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getData()
 | 
			
		||||
    {
 | 
			
		||||
        return data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setData( String data )
 | 
			
		||||
    {
 | 
			
		||||
        this.data = data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getSeqNo()
 | 
			
		||||
    {
 | 
			
		||||
        return seqNo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setSeqNo( String seqNo )
 | 
			
		||||
    {
 | 
			
		||||
        this.seqNo = seqNo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "code" )
 | 
			
		||||
    private String code;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "message" )
 | 
			
		||||
    private String message;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "data" )
 | 
			
		||||
    private String data;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "seqNo" )
 | 
			
		||||
    private String seqNo;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,65 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-05-25 11:14:03
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /NewCitizenQueryResult/src/main/java/com/cpic/xim/utils/decryption/DecryptionUtils.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.utils.security.decode;
 | 
			
		||||
 | 
			
		||||
import javax.crypto.Cipher;
 | 
			
		||||
import javax.crypto.spec.IvParameterSpec;
 | 
			
		||||
import javax.crypto.spec.SecretKeySpec;
 | 
			
		||||
import org.apache.commons.lang3.StringUtils;
 | 
			
		||||
import java.util.Base64;
 | 
			
		||||
import java.util.Base64.Decoder;
 | 
			
		||||
 | 
			
		||||
public class DecryptionUtils
 | 
			
		||||
{
 | 
			
		||||
    public DecryptionUtils()
 | 
			
		||||
    {}
 | 
			
		||||
 | 
			
		||||
    private static String aesDecryptByBytes( byte[] encryptBytes, String decryptKey )
 | 
			
		||||
            throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        Cipher cipher = Cipher.getInstance( "AES/CBC/NoPadding" );
 | 
			
		||||
        SecretKeySpec keySpec = new SecretKeySpec( decryptKey.getBytes(), "AES" );
 | 
			
		||||
        IvParameterSpec ivSpec = new IvParameterSpec( decryptKey.getBytes() );
 | 
			
		||||
 | 
			
		||||
        cipher.init( 2, keySpec, ivSpec );
 | 
			
		||||
 | 
			
		||||
        byte[] decryptBytes = cipher.doFinal( encryptBytes );
 | 
			
		||||
 | 
			
		||||
        String result = new String( decryptBytes );
 | 
			
		||||
 | 
			
		||||
        if ( StringUtils.isNotBlank( result ) )
 | 
			
		||||
        {
 | 
			
		||||
            result = result.trim();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static String aesDecrypt( String encryptStr, String decryptKey ) throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            return StringUtils.isBlank( encryptStr ) ? null
 | 
			
		||||
                    : aesDecryptByBytes( base64Decode( encryptStr ), decryptKey );
 | 
			
		||||
        }
 | 
			
		||||
        catch ( Exception var3 )
 | 
			
		||||
        {
 | 
			
		||||
            throw new Exception( "解密失败!" );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static byte[] base64Decode( String base64Code ) throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        Decoder decoder = Base64.getDecoder();
 | 
			
		||||
        byte[] buffer = decoder.decode( base64Code );
 | 
			
		||||
 | 
			
		||||
        return StringUtils.isBlank( base64Code ) ? null : buffer;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,64 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-05-25 11:13:17
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /NewCitizenQueryResult/src/main/java/com/cpic/xim/utils/security/encode/EncryptionUtils.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.utils.security.encode;
 | 
			
		||||
 | 
			
		||||
// package com.cdp.product.security.encode;
 | 
			
		||||
 | 
			
		||||
import javax.crypto.Cipher;
 | 
			
		||||
import javax.crypto.spec.IvParameterSpec;
 | 
			
		||||
import javax.crypto.spec.SecretKeySpec;
 | 
			
		||||
import java.util.Base64;
 | 
			
		||||
import java.util.Base64.Encoder;
 | 
			
		||||
 | 
			
		||||
public class EncryptionUtils
 | 
			
		||||
{
 | 
			
		||||
    public EncryptionUtils()
 | 
			
		||||
    {}
 | 
			
		||||
 | 
			
		||||
    private static byte[] aesEncryptToBytes( String content, String encryptKey ) throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        Cipher cipher = Cipher.getInstance( "AES/CBC/NoPadding" );
 | 
			
		||||
        byte[] dataBytes = content.getBytes( "utf-8" );
 | 
			
		||||
        int blockSize = cipher.getBlockSize();
 | 
			
		||||
        int plaintextLength = dataBytes.length;
 | 
			
		||||
 | 
			
		||||
        if ( plaintextLength % blockSize != 0 )
 | 
			
		||||
        {
 | 
			
		||||
            plaintextLength += blockSize - plaintextLength % blockSize;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        byte[] plaintext = new byte[plaintextLength];
 | 
			
		||||
 | 
			
		||||
        SecretKeySpec keySpec = new SecretKeySpec( encryptKey.getBytes(), "AES" );
 | 
			
		||||
        IvParameterSpec ivSpec = new IvParameterSpec( encryptKey.getBytes() );
 | 
			
		||||
 | 
			
		||||
        System.arraycopy( dataBytes, 0, plaintext, 0, dataBytes.length );
 | 
			
		||||
 | 
			
		||||
        cipher.init( 1, keySpec, ivSpec );
 | 
			
		||||
 | 
			
		||||
        return cipher.doFinal( plaintext );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static String aesEncrypt( String content, String encryptKey )
 | 
			
		||||
            throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            Encoder encoder = Base64.getEncoder();
 | 
			
		||||
            String encode = encoder.encodeToString(aesEncryptToBytes( content, encryptKey ));
 | 
			
		||||
 | 
			
		||||
            return encode;
 | 
			
		||||
        }
 | 
			
		||||
        catch ( Exception var3 )
 | 
			
		||||
        {
 | 
			
		||||
            throw new Exception( "加密失败!" );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,82 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-05-25 19:36:27
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /NewCitizenQueryResult/src/main/java/com/cpic/xim/utils/security/sign/SignUtils.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.utils.security.sign;
 | 
			
		||||
 | 
			
		||||
import java.security.MessageDigest;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import org.apache.commons.lang3.StringUtils;
 | 
			
		||||
import java.util.Base64;
 | 
			
		||||
import java.util.Base64.Encoder;
 | 
			
		||||
 | 
			
		||||
public class SignUtils
 | 
			
		||||
{
 | 
			
		||||
    public SignUtils()
 | 
			
		||||
    {}
 | 
			
		||||
 | 
			
		||||
    private static byte[] md5( byte[] bytes ) throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        MessageDigest md = MessageDigest.getInstance( "MD5" );
 | 
			
		||||
 | 
			
		||||
        md.update( bytes );
 | 
			
		||||
 | 
			
		||||
        return md.digest();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static byte[] md5( String msg ) throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        return StringUtils.isBlank( msg ) ? null : md5( msg.getBytes() );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static String md5Encrypt( String msg ) throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        Encoder encoder = Base64.getEncoder();
 | 
			
		||||
        String encode = encoder.encodeToString(md5(msg));
 | 
			
		||||
 | 
			
		||||
        return StringUtils.isBlank( msg ) ? null : encode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static String sign( Map<String, String> param ) throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            Set<String> paramKey = param.keySet();
 | 
			
		||||
            String[] strs =
 | 
			
		||||
                    (String[]) (new ArrayList( paramKey )).toArray( new String[paramKey.size()] );
 | 
			
		||||
            Arrays.sort( strs );
 | 
			
		||||
            StringBuilder sb = new StringBuilder();
 | 
			
		||||
            String[] var4 = strs;
 | 
			
		||||
            int var5 = strs.length;
 | 
			
		||||
 | 
			
		||||
            for ( int var6 = 0; var6 < var5; ++var6 )
 | 
			
		||||
            {
 | 
			
		||||
                String str = var4[var6];
 | 
			
		||||
                
 | 
			
		||||
                sb.append( str ).append( "=" ).append( (String) param.get( str ) ).append( "&" );
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            String result = sb.toString();
 | 
			
		||||
 | 
			
		||||
            if ( StringUtils.isNotBlank( result ) && result.endsWith( "&" ) )
 | 
			
		||||
            {
 | 
			
		||||
                return md5Encrypt( result.substring( 0, result.length() - 1 ) );
 | 
			
		||||
            } else
 | 
			
		||||
            {
 | 
			
		||||
                throw new Exception( "未收到用于签名的参数,签名失败!" );
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        catch ( Exception var8 )
 | 
			
		||||
        {
 | 
			
		||||
            throw new Exception( "签名失败!" );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,46 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: Kane Wang <wangkane@qq.com>
 | 
			
		||||
 * @Date: 2023-05-26 18:40:36
 | 
			
		||||
 * @LastEditors: Kane Wang
 | 
			
		||||
 * @LastModified: 2025-05-07 14:59:15
 | 
			
		||||
 * @FilePath: src/main/java/com/cpic/xim/web/controllers/NewCitizen/IdentifyNewCitizenRequest.java
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * 
 | 
			
		||||
 *               Copyright (c) 2025 by Kane All rights reserved
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.web.controllers.newcitizen;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class IdentifyNewCitizenRequest
 | 
			
		||||
{
 | 
			
		||||
    public IdentifyNewCitizenRequest()
 | 
			
		||||
    {
 | 
			
		||||
    }  
 | 
			
		||||
 | 
			
		||||
    public String getIdCardNo()  
 | 
			
		||||
    {
 | 
			
		||||
        return idCardNo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setIdCardNo( String idCardNo )
 | 
			
		||||
    {
 | 
			
		||||
        this.idCardNo = idCardNo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getName()
 | 
			
		||||
    {
 | 
			
		||||
        return name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setName( String name )
 | 
			
		||||
    {
 | 
			
		||||
        this.name = name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "idcard_no" )
 | 
			
		||||
    private String idCardNo;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "name" )
 | 
			
		||||
    private String name;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,83 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: Kane Wang <wangkane@qq.com>
 | 
			
		||||
 * @Date: 2024-04-29 11:09:50
 | 
			
		||||
 * @LastEditors: Kane Wang
 | 
			
		||||
 * @LastModified: 2025-05-07 22:01:21
 | 
			
		||||
 * @FilePath: src/main/java/com/cpic/xim/web/controllers/newcitizen/IdentifyNewCitizenResponse.java
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * 
 | 
			
		||||
 *               Copyright (c) 2025 by Kane All rights reserved
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.web.controllers.newcitizen;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class IdentifyNewCitizenResponse
 | 
			
		||||
{
 | 
			
		||||
    public IdentifyNewCitizenResponse() {}
 | 
			
		||||
 | 
			
		||||
    public boolean isSuccess()
 | 
			
		||||
    {
 | 
			
		||||
        return success;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setSuccess( boolean success )
 | 
			
		||||
    {
 | 
			
		||||
        this.success = success;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getMessage()
 | 
			
		||||
    {
 | 
			
		||||
        return message;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setMessage( String message )
 | 
			
		||||
    {
 | 
			
		||||
        this.message = message;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getCitizenType()
 | 
			
		||||
    {
 | 
			
		||||
        return citizenType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCitizenType( String citizenType )
 | 
			
		||||
    {
 | 
			
		||||
        this.citizenType = citizenType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getExpireDate()
 | 
			
		||||
    {
 | 
			
		||||
        return expireDate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setExpireDate( String expireDate )
 | 
			
		||||
    {
 | 
			
		||||
        this.expireDate = expireDate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getScore()
 | 
			
		||||
    {
 | 
			
		||||
        return score;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setScore( String score )
 | 
			
		||||
    {
 | 
			
		||||
        this.score = score;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("success")
 | 
			
		||||
    private boolean success;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("message")
 | 
			
		||||
    private String message;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("citizentype")
 | 
			
		||||
    private String citizenType;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("expiredate")
 | 
			
		||||
    private String expireDate;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("score")
 | 
			
		||||
    private String score;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,61 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: Kane Wang <wangkane@qq.com>
 | 
			
		||||
 * @Date: 2024-04-29 11:09:50
 | 
			
		||||
 * @LastEditors: Kane Wang
 | 
			
		||||
 * @LastModified: 2025-05-07 22:00:48
 | 
			
		||||
 * @FilePath: src/main/java/com/cpic/xim/web/controllers/newcitizen/QueryResultController.java
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * 
 | 
			
		||||
 *               Copyright (c) 2025 by Kane All rights reserved
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.web.controllers.newcitizen;
 | 
			
		||||
 | 
			
		||||
import jakarta.servlet.http.HttpServletResponse;
 | 
			
		||||
import org.springframework.stereotype.Controller;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.ResponseBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
 | 
			
		||||
import com.cpic.xim.utils.newcitizen.*;
 | 
			
		||||
 | 
			
		||||
// 9ILpXKFSHckH1g7h
 | 
			
		||||
 | 
			
		||||
@Controller
 | 
			
		||||
public class QueryResultController
 | 
			
		||||
{
 | 
			
		||||
    @RequestMapping( "/save_score.do" )
 | 
			
		||||
    public void saveQueryResult( HttpServletResponse response, @RequestBody QueryResultRequest result )
 | 
			
		||||
    {
 | 
			
		||||
        response.setStatus( HttpServletResponse.SC_OK );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping( "/identify.do" )
 | 
			
		||||
    @ResponseBody
 | 
			
		||||
    public IdentifyNewCitizenResponse identifyNewCitizen( @RequestBody IdentifyNewCitizenRequest request )
 | 
			
		||||
    {
 | 
			
		||||
        String                     idCardNo = request.getIdCardNo();
 | 
			
		||||
        String                     name     = request.getName();
 | 
			
		||||
        IdentifyResult             result   = null;
 | 
			
		||||
        IdentifyNewCitizenResponse response = new IdentifyNewCitizenResponse();
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            result = NewCitizenUitls.identifyNewCitizen( idCardNo, name );
 | 
			
		||||
 | 
			
		||||
            response.setSuccess( true );
 | 
			
		||||
            response.setMessage( "调用成功" );
 | 
			
		||||
            response.setCitizenType( result.getCitizenType() );
 | 
			
		||||
            response.setScore( result.getScore() );
 | 
			
		||||
            response.setExpireDate( result.getExpireDate() );
 | 
			
		||||
        }
 | 
			
		||||
        catch ( Exception error )
 | 
			
		||||
        {
 | 
			
		||||
            System.out.println( error.getMessage() );
 | 
			
		||||
 | 
			
		||||
            response.setSuccess( false );
 | 
			
		||||
            response.setMessage( error.getMessage() );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return response;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,47 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: Kane Wang <wangkane@qq.com>
 | 
			
		||||
 * @Date: 2024-04-29 11:09:50
 | 
			
		||||
 * @LastEditors: Kane Wang
 | 
			
		||||
 * @LastModified: 2025-05-07 22:00:35
 | 
			
		||||
 * @FilePath: src/main/java/com/cpic/xim/web/controllers/newcitizen/QueryResultRequest.java
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * 
 | 
			
		||||
 *               Copyright (c) 2025 by Kane All rights reserved
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.web.controllers.newcitizen;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class QueryResultRequest
 | 
			
		||||
{
 | 
			
		||||
    public QueryResultRequest() {}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public String getIdCardMD5()
 | 
			
		||||
    {
 | 
			
		||||
        return idCardMD5;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setIdCardMD5( String idCardMD5 )
 | 
			
		||||
    {
 | 
			
		||||
        this.idCardMD5 = idCardMD5;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getScore()
 | 
			
		||||
    {
 | 
			
		||||
        return score;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setScore( String score )
 | 
			
		||||
    {
 | 
			
		||||
        this.score = score;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("idcardmd5")
 | 
			
		||||
    private String idCardMD5;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("score")
 | 
			
		||||
    private String score;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,55 @@
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: Kane Wang <wangkane@qq.com>
 | 
			
		||||
 * @Date: 2023-05-26 18:40:36
 | 
			
		||||
 * @LastEditors: Kane Wang
 | 
			
		||||
 * @LastModified: 2025-05-07 22:00:26
 | 
			
		||||
 * @FilePath: src/main/java/com/cpic/xim/web/filters/CrosFilter.java
 | 
			
		||||
 * @Description:
 | 
			
		||||
 * 
 | 
			
		||||
 *               Copyright (c) 2025 by Kane All rights reserved
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.web.filters;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import jakarta.servlet.Filter;
 | 
			
		||||
import jakarta.servlet.FilterChain;
 | 
			
		||||
import jakarta.servlet.ServletException;
 | 
			
		||||
import jakarta.servlet.ServletRequest;
 | 
			
		||||
import jakarta.servlet.ServletResponse;
 | 
			
		||||
import jakarta.servlet.http.HttpServletRequest;
 | 
			
		||||
import jakarta.servlet.http.HttpServletResponse;
 | 
			
		||||
import org.springframework.http.HttpMethod;
 | 
			
		||||
 | 
			
		||||
public class CrosFilter implements Filter
 | 
			
		||||
{
 | 
			
		||||
    @Override
 | 
			
		||||
    public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain )
 | 
			
		||||
                                                                                        throws ServletException,
 | 
			
		||||
                                                                                        IOException
 | 
			
		||||
    {
 | 
			
		||||
        HttpServletRequest  request      = ( HttpServletRequest ) req;
 | 
			
		||||
        HttpServletResponse response     = ( HttpServletResponse ) resp;
 | 
			
		||||
        String              method       = request.getMethod();
 | 
			
		||||
        String              originHeader = request.getHeader( "Origin" );
 | 
			
		||||
 | 
			
		||||
        System.out.println( "收到" + method + "请求,来自" + originHeader );
 | 
			
		||||
 | 
			
		||||
        // 如果是Options请求
 | 
			
		||||
        if ( method.equals( HttpMethod.OPTIONS.toString() ) )
 | 
			
		||||
        {
 | 
			
		||||
            originHeader = "*";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        response.setHeader( "Access-Control-Allow-Origin", originHeader );
 | 
			
		||||
        response.setHeader( "Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT" );
 | 
			
		||||
        response.setHeader( "Access-Control-Max-Age", "0" );
 | 
			
		||||
        response.setHeader( "Access-Control-Allow-Headers",
 | 
			
		||||
                            "Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With,userId,token" );
 | 
			
		||||
        response.setHeader( "Access-Control-Allow-Credentials", "true" );
 | 
			
		||||
        response.setHeader( "XDomainRequestAllowed", "1" );
 | 
			
		||||
        response.setHeader( "XDomainRequestAllowed", "1" );
 | 
			
		||||
 | 
			
		||||
        chain.doFilter( request, response );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,36 @@
 | 
			
		||||
<beans xmlns="http://www.springframework.org/schema/beans"
 | 
			
		||||
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
			
		||||
    xmlns:context="http://www.springframework.org/schema/context"
 | 
			
		||||
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
 | 
			
		||||
    xmlns:jee="http://www.springframework.org/schema/jee"
 | 
			
		||||
    xmlns:tx="http://www.springframework.org/schema/tx"
 | 
			
		||||
    xmlns:aop="http://www.springframework.org/schema/aop"
 | 
			
		||||
    xmlns:mvc="http://www.springframework.org/schema/mvc"
 | 
			
		||||
    xmlns:util="http://www.springframework.org/schema/util"
 | 
			
		||||
    xmlns:jpa="http://www.springframework.org/schema/data/jpa"
 | 
			
		||||
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
 | 
			
		||||
                        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
 | 
			
		||||
                        http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd
 | 
			
		||||
                        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd
 | 
			
		||||
                        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
 | 
			
		||||
                        http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
 | 
			
		||||
                        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
 | 
			
		||||
                        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
 | 
			
		||||
                        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd">
 | 
			
		||||
    <mvc:annotation-driven />
 | 
			
		||||
    <context:component-scan base-package="com.cpic.xim" />
 | 
			
		||||
    <mvc:default-servlet-handler />
 | 
			
		||||
 | 
			
		||||
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
 | 
			
		||||
        <property
 | 
			
		||||
            name="prefix" value="/WEB-INF/jsp/" />
 | 
			
		||||
        <property name="suffix" value=".jsp" />
 | 
			
		||||
    </bean>
 | 
			
		||||
 | 
			
		||||
    <!-- <bean id="multipartResolver"
 | 
			
		||||
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
 | 
			
		||||
        <property name="defaultEncoding" value="UTF-8" />
 | 
			
		||||
        <property name="maxUploadSize" value="-1" />
 | 
			
		||||
    </bean> -->
 | 
			
		||||
 | 
			
		||||
</beans>
 | 
			
		||||
@@ -0,0 +1,35 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<web-app
 | 
			
		||||
  version="4.0"
 | 
			
		||||
  xmlns="http://xmlns.jcp.org/xml/ns/javaee"
 | 
			
		||||
  xmlns:javaee="http://xmlns.jcp.org/xml/ns/javaee"
 | 
			
		||||
  xmlns:xml="http://www.w3.org/XML/1998/namespace"
 | 
			
		||||
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
			
		||||
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">
 | 
			
		||||
 | 
			
		||||
  <display-name>Archetype Created Web Application</display-name>
 | 
			
		||||
 | 
			
		||||
  <servlet>
 | 
			
		||||
    <servlet-name>springmvc</servlet-name>
 | 
			
		||||
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
 | 
			
		||||
    <init-param>
 | 
			
		||||
      <param-name>contextConfigLocation</param-name>
 | 
			
		||||
      <param-value>classpath:spring.xml</param-value>
 | 
			
		||||
    </init-param>
 | 
			
		||||
    <load-on-startup>1</load-on-startup>
 | 
			
		||||
  </servlet>
 | 
			
		||||
  <servlet-mapping>
 | 
			
		||||
    <servlet-name>springmvc</servlet-name>
 | 
			
		||||
    <url-pattern>*.do</url-pattern>
 | 
			
		||||
  </servlet-mapping>
 | 
			
		||||
 | 
			
		||||
  <filter>
 | 
			
		||||
    <filter-name>CrosFilter</filter-name>
 | 
			
		||||
    <filter-class>com.cpic.xim.web.filters.CrosFilter</filter-class>
 | 
			
		||||
  </filter>
 | 
			
		||||
  <filter-mapping>
 | 
			
		||||
    <filter-name>CrosFilter</filter-name>
 | 
			
		||||
    <url-pattern>*</url-pattern>
 | 
			
		||||
  </filter-mapping>
 | 
			
		||||
 | 
			
		||||
</web-app>
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
<html>
 | 
			
		||||
<body>
 | 
			
		||||
<h2>Hello World!</h2>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -0,0 +1,52 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-05-25 10:36:14
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /NewCitizenQueryResult/src/test/java/com/cpic/xim/test/NewCitizenQueryResultTest.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.test;
 | 
			
		||||
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
import static org.junit.Assert.assertTrue;
 | 
			
		||||
import org.apache.shiro.crypto.hash.Md5Hash;
 | 
			
		||||
import com.cpic.xim.utils.newcitizen.NewCitizenUitls;
 | 
			
		||||
import com.cpic.xim.utils.newcitizen.IdentifyResult;
 | 
			
		||||
 | 
			
		||||
public class NewCitizenQueryResultTest
 | 
			
		||||
{
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testSaveQueryResult()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testMd5Hash()
 | 
			
		||||
    {
 | 
			
		||||
        String idCardNo = "350402198106130016";
 | 
			
		||||
 | 
			
		||||
        Md5Hash idCardNoHash = new Md5Hash( idCardNo );
 | 
			
		||||
 | 
			
		||||
        System.out.println( "身份证hash值:" + idCardNoHash.toString() );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testIdentify()
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            IdentifyResult result = NewCitizenUitls.identifyNewCitizen( "350403199801027011", "涂弘森" );
 | 
			
		||||
        
 | 
			
		||||
            assertTrue("测试调用成功", result.getCitizenType().isEmpty() == false);
 | 
			
		||||
        }
 | 
			
		||||
        catch ( Exception error )
 | 
			
		||||
        {
 | 
			
		||||
            assert( false );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								code/console/newcitizen/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								code/console/newcitizen/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
{
 | 
			
		||||
    "java.configuration.updateBuildConfiguration": "automatic",
 | 
			
		||||
    "java.compile.nullAnalysis.mode": "automatic"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										187
									
								
								code/console/newcitizen/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										187
									
								
								code/console/newcitizen/pom.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,187 @@
 | 
			
		||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
 | 
			
		||||
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
			
		||||
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 | 
			
		||||
  <modelVersion>4.0.0</modelVersion>
 | 
			
		||||
 | 
			
		||||
  <groupId>com.cpic.xim</groupId>
 | 
			
		||||
  <artifactId>newcitizen</artifactId>
 | 
			
		||||
  <version>1.0-SNAPSHOT</version>
 | 
			
		||||
  <packaging>jar</packaging>
 | 
			
		||||
 | 
			
		||||
  <name>newcitizen</name>
 | 
			
		||||
  <url>http://maven.apache.org</url>
 | 
			
		||||
 | 
			
		||||
  <properties>
 | 
			
		||||
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
			
		||||
    <maven.compiler.source>1.8</maven.compiler.source>
 | 
			
		||||
    <maven.compiler.target>1.8</maven.compiler.target>
 | 
			
		||||
    <spring.version>5.3.24</spring.version>
 | 
			
		||||
  </properties>
 | 
			
		||||
 | 
			
		||||
  <dependencies>
 | 
			
		||||
    <!-- https://mvnrepository.com/artifact/junit/junit -->
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>junit</groupId>
 | 
			
		||||
      <artifactId>junit</artifactId>
 | 
			
		||||
      <version>4.13.2</version>
 | 
			
		||||
      <scope>test</scope>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.springframework</groupId>
 | 
			
		||||
      <artifactId>spring-context</artifactId>
 | 
			
		||||
      <version>${spring.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.springframework</groupId>
 | 
			
		||||
      <artifactId>spring-test</artifactId>
 | 
			
		||||
      <version>${spring.version}</version>
 | 
			
		||||
      <scope>test</scope>
 | 
			
		||||
    </dependency>
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.springframework</groupId>
 | 
			
		||||
      <artifactId>spring-web</artifactId>
 | 
			
		||||
      <version>${spring.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.springframework</groupId>
 | 
			
		||||
      <artifactId>spring-webmvc</artifactId>
 | 
			
		||||
      <version>${spring.version}</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>javax.servlet</groupId>
 | 
			
		||||
      <artifactId>javax.servlet-api</artifactId>
 | 
			
		||||
      <version>4.0.1</version>
 | 
			
		||||
      <scope>provided</scope>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <!--文件上传依赖的两个jar包-->
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>commons-fileupload</groupId>
 | 
			
		||||
      <artifactId>commons-fileupload</artifactId>
 | 
			
		||||
      <version>1.5</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>commons-io</groupId>
 | 
			
		||||
      <artifactId>commons-io</artifactId>
 | 
			
		||||
      <version>2.11.0</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <!--jackson-->
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>com.fasterxml.jackson.core</groupId>
 | 
			
		||||
      <artifactId>jackson-databind</artifactId>
 | 
			
		||||
      <version>2.14.2</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
    <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>com.fasterxml.jackson.core</groupId>
 | 
			
		||||
      <artifactId>jackson-core</artifactId>
 | 
			
		||||
      <version>2.13.4</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
    <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>com.fasterxml.jackson.core</groupId>
 | 
			
		||||
      <artifactId>jackson-annotations</artifactId>
 | 
			
		||||
      <version>2.13.4</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>com.oracle</groupId>
 | 
			
		||||
      <artifactId>ojdbc8</artifactId>
 | 
			
		||||
      <version>19.3.0.0.0</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.shiro</groupId>
 | 
			
		||||
      <artifactId>shiro-all</artifactId>
 | 
			
		||||
      <version>1.11.0</version>
 | 
			
		||||
      <type>pom</type>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <!-- <dependency>
 | 
			
		||||
      <groupId>com.cdp.product</groupId>
 | 
			
		||||
      <artifactId>cdp-common-security</artifactId>
 | 
			
		||||
      <version>3.5.0</version>
 | 
			
		||||
    </dependency> -->
 | 
			
		||||
 | 
			
		||||
    <!-- <dependency>
 | 
			
		||||
      <groupId>com.cdp.product</groupId>
 | 
			
		||||
      <artifactId>cdp-common-security</artifactId>
 | 
			
		||||
      <version>3.5.0</version>
 | 
			
		||||
      <scope>system</scope>
 | 
			
		||||
      <systemPath>${project.basedir}/lib/cdp-common-security-3.5.0.jar</systemPath>
 | 
			
		||||
    </dependency> -->
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.httpcomponents</groupId>
 | 
			
		||||
      <artifactId>httpclient</artifactId>
 | 
			
		||||
      <version>4.5.14</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
      <groupId>org.apache.httpcomponents</groupId>
 | 
			
		||||
      <artifactId>httpcore</artifactId>
 | 
			
		||||
      <version>4.4.5</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
    <dependency>
 | 
			
		||||
        <groupId>org.apache.commons</groupId>
 | 
			
		||||
        <artifactId>commons-lang3</artifactId>
 | 
			
		||||
        <version>3.7</version>
 | 
			
		||||
    </dependency>
 | 
			
		||||
 | 
			
		||||
  </dependencies>
 | 
			
		||||
  <build>
 | 
			
		||||
    <defaultGoal>compile</defaultGoal>
 | 
			
		||||
    <plugins>
 | 
			
		||||
      <plugin>
 | 
			
		||||
        <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
        <artifactId>maven-compiler-plugin</artifactId>
 | 
			
		||||
        <version>3.8.1</version>
 | 
			
		||||
        <configuration>
 | 
			
		||||
          <source>1.8</source>
 | 
			
		||||
          <target>1.8</target>
 | 
			
		||||
          <encoding>UTF-8</encoding>
 | 
			
		||||
          <compireArguments>
 | 
			
		||||
            <extdirs>${project.basedir}\lib</extdirs>
 | 
			
		||||
          </compireArguments>
 | 
			
		||||
        </configuration>
 | 
			
		||||
      </plugin>
 | 
			
		||||
      <plugin>
 | 
			
		||||
        <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
        <artifactId>maven-surefire-plugin</artifactId>
 | 
			
		||||
        <version>3.0.0-M6</version>
 | 
			
		||||
        <configuration>
 | 
			
		||||
          <skipTests>true</skipTests>
 | 
			
		||||
        </configuration>
 | 
			
		||||
      </plugin>
 | 
			
		||||
      <plugin>
 | 
			
		||||
        <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
        <artifactId>maven-assembly-plugin</artifactId>
 | 
			
		||||
        <configuration>
 | 
			
		||||
          <descriptorRefs>
 | 
			
		||||
            <descriptorRef>jar-with-dependencies</descriptorRef>
 | 
			
		||||
          </descriptorRefs>
 | 
			
		||||
          <archive>
 | 
			
		||||
            <manifest>
 | 
			
		||||
              <mainClass>AppMain</mainClass>
 | 
			
		||||
            </manifest>
 | 
			
		||||
          </archive>
 | 
			
		||||
        </configuration>
 | 
			
		||||
        <executions>
 | 
			
		||||
          <execution>
 | 
			
		||||
            <id>make-assmenbly</id>
 | 
			
		||||
            <phase>package</phase>
 | 
			
		||||
            <goals>
 | 
			
		||||
              <goal>single</goal>
 | 
			
		||||
            </goals>
 | 
			
		||||
          </execution>
 | 
			
		||||
        </executions>
 | 
			
		||||
      </plugin>
 | 
			
		||||
    </plugins>
 | 
			
		||||
  </build>
 | 
			
		||||
</project>
 | 
			
		||||
							
								
								
									
										13
									
								
								code/console/newcitizen/src/main/java/com/cpic/xim/App.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								code/console/newcitizen/src/main/java/com/cpic/xim/App.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
package com.cpic.xim;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Hello world!
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
public class App 
 | 
			
		||||
{
 | 
			
		||||
    public static void main( String[] args )
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println( "Hello World!" );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,18 @@
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.utils.config;
 | 
			
		||||
 | 
			
		||||
public class EncryptionParameters
 | 
			
		||||
{
 | 
			
		||||
    private static String SECRET_KEY = "9ILpXKFSHckH1g7h";
 | 
			
		||||
    private static String KEY = "2d716d5c7b35d5c0d41199eb0fd789ca";
 | 
			
		||||
 | 
			
		||||
    public static String getSecretKey()
 | 
			
		||||
    {
 | 
			
		||||
        return EncryptionParameters.SECRET_KEY;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static String getKey()
 | 
			
		||||
    {
 | 
			
		||||
        return EncryptionParameters.KEY;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,63 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-05-25 11:14:03
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /NewCitizenQueryResult/src/main/java/com/cpic/xim/utils/decryption/DecryptionUtils.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.utils.decryption;
 | 
			
		||||
 | 
			
		||||
import javax.crypto.Cipher;
 | 
			
		||||
import javax.crypto.spec.IvParameterSpec;
 | 
			
		||||
import javax.crypto.spec.SecretKeySpec;
 | 
			
		||||
import org.apache.commons.lang3.StringUtils;
 | 
			
		||||
import sun.misc.BASE64Decoder;
 | 
			
		||||
 | 
			
		||||
public class CdpDecryptUtil
 | 
			
		||||
{
 | 
			
		||||
    public CdpDecryptUtil()
 | 
			
		||||
    {}
 | 
			
		||||
 | 
			
		||||
    private static String aesDecryptByBytes( byte[] encryptBytes, String decryptKey )
 | 
			
		||||
            throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        Cipher cipher = Cipher.getInstance( "AES/CBC/NoPadding" );
 | 
			
		||||
        SecretKeySpec keySpec = new SecretKeySpec( decryptKey.getBytes(), "AES" );
 | 
			
		||||
        IvParameterSpec ivSpec = new IvParameterSpec( decryptKey.getBytes() );
 | 
			
		||||
 | 
			
		||||
        cipher.init( 2, keySpec, ivSpec );
 | 
			
		||||
 | 
			
		||||
        byte[] decryptBytes = cipher.doFinal( encryptBytes );
 | 
			
		||||
 | 
			
		||||
        String result = new String( decryptBytes );
 | 
			
		||||
 | 
			
		||||
        if ( StringUtils.isNotBlank( result ) )
 | 
			
		||||
        {
 | 
			
		||||
            result = result.trim();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static String aesDecrypt( String encryptStr, String decryptKey )
 | 
			
		||||
            throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            return StringUtils.isBlank( encryptStr ) ? null
 | 
			
		||||
                    : aesDecryptByBytes( base64Decode( encryptStr ), decryptKey );
 | 
			
		||||
        }
 | 
			
		||||
        catch ( Exception var3 )
 | 
			
		||||
        {
 | 
			
		||||
            throw new Exception( "解密失败!" );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static byte[] base64Decode( String base64Code ) throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        return StringUtils.isBlank( base64Code ) ? null
 | 
			
		||||
                : (new BASE64Decoder()).decodeBuffer( base64Code );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,20 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-05-25 11:13:17
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /NewCitizenQueryResult/src/main/java/com/cpic/xim/utils/encryption/EncryptionUtils.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.utils.encryption;
 | 
			
		||||
 | 
			
		||||
public class EncryptionUtils
 | 
			
		||||
{
 | 
			
		||||
    static public String md5Hash( String value )
 | 
			
		||||
    {
 | 
			
		||||
        String result = "";
 | 
			
		||||
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,48 @@
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.utils.newcitizen;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class IdentifyResult
 | 
			
		||||
{
 | 
			
		||||
    public IdentifyResult() {}
 | 
			
		||||
    
 | 
			
		||||
    public String getCitizenType()
 | 
			
		||||
    {
 | 
			
		||||
        return citizenType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCitizenType( String citizenType )
 | 
			
		||||
    {
 | 
			
		||||
        this.citizenType = citizenType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getExpireDate()
 | 
			
		||||
    {
 | 
			
		||||
        return expireDate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setExpireDate( String expireDate )
 | 
			
		||||
    {
 | 
			
		||||
        this.expireDate = expireDate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getScore()
 | 
			
		||||
    {
 | 
			
		||||
        return score;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setScore( String score )
 | 
			
		||||
    {
 | 
			
		||||
        this.score = score;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("citizentype")
 | 
			
		||||
    private String citizenType;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("expiredate")
 | 
			
		||||
    private String expireDate;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("score")
 | 
			
		||||
    private String score;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,169 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-05-25 15:26:09
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /newcitizen/src/main/java/com/cpic/xim/utils/newcitizen/NewCitizenUitls.java
 | 
			
		||||
 * @Description: 新市民认证相关的工具方法
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.utils.newcitizen;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import org.apache.http.HttpEntity;
 | 
			
		||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
 | 
			
		||||
import org.apache.http.client.methods.CloseableHttpResponse;
 | 
			
		||||
import org.apache.http.client.methods.HttpPost;
 | 
			
		||||
import org.apache.http.impl.client.CloseableHttpClient;
 | 
			
		||||
import org.apache.http.impl.client.HttpClients;
 | 
			
		||||
import org.apache.http.message.BasicNameValuePair;
 | 
			
		||||
import org.apache.http.util.EntityUtils;
 | 
			
		||||
import com.cdp.product.security.decode.CdpDecryptUtil;
 | 
			
		||||
import com.cdp.product.security.encode.CdpEncryptUtil;
 | 
			
		||||
import com.cdp.product.security.sign.CdpSignUtil;
 | 
			
		||||
import com.cpic.xim.utils.config.EncryptionParameters;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
import com.fasterxml.jackson.databind.ObjectMapper;
 | 
			
		||||
 | 
			
		||||
public class NewCitizenUitls
 | 
			
		||||
{
 | 
			
		||||
    // 请求地址
 | 
			
		||||
    private static String identifyURL = "https://api.xmcic.cn:51888/government/economic/352";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新市民验证
 | 
			
		||||
     * @param idCardNo 身份证号码
 | 
			
		||||
     * @param name 姓名
 | 
			
		||||
     * @return
 | 
			
		||||
     * @throws Exception
 | 
			
		||||
     */
 | 
			
		||||
    public static IdentifyResult identifyNewCitizen( String idCardNo, String name ) throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        String secretKey = EncryptionParameters.getSecretKey();
 | 
			
		||||
        String key = EncryptionParameters.getKey();
 | 
			
		||||
        String pushURL = "http://222.76.244.118:11101/NewCitizen/save_score.do";
 | 
			
		||||
        
 | 
			
		||||
        Map<String, String> param = new HashMap<String, String>();
 | 
			
		||||
 | 
			
		||||
        param.put( "authorized", CdpEncryptUtil.aesEncrypt( "1", secretKey ) );
 | 
			
		||||
        param.put( "idcard", CdpEncryptUtil.aesEncrypt( idCardNo, secretKey ) );
 | 
			
		||||
        param.put( "name", CdpEncryptUtil.aesEncrypt( name, secretKey ) );
 | 
			
		||||
        param.put( "pushurl", CdpEncryptUtil.aesEncrypt( pushURL, secretKey ) );
 | 
			
		||||
        param.put( "timestamp",
 | 
			
		||||
                CdpEncryptUtil.aesEncrypt( System.currentTimeMillis() + "", secretKey ) );
 | 
			
		||||
 | 
			
		||||
        String sign = CdpSignUtil.sign( param );
 | 
			
		||||
        Map<String, String> params = new HashMap<>();
 | 
			
		||||
 | 
			
		||||
        params.putAll( param );
 | 
			
		||||
        params.put( "key", key );
 | 
			
		||||
        params.put("sign", sign);
 | 
			
		||||
 | 
			
		||||
        String resultJSON = sendPost( identifyURL, params);
 | 
			
		||||
        ObjectMapper mapper = new ObjectMapper();
 | 
			
		||||
 | 
			
		||||
        ResponseResult response = mapper.readValue( resultJSON, ResponseResult.class );
 | 
			
		||||
 | 
			
		||||
        // 请求结果解密,应为一个json
 | 
			
		||||
        String identifyJSON = CdpDecryptUtil.aesDecrypt(response.getData(), secretKey);
 | 
			
		||||
 | 
			
		||||
        IdentifyResult identifyResult = mapper.readValue( identifyJSON, IdentifyResult.class );
 | 
			
		||||
 | 
			
		||||
        return identifyResult;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static String sendPost( String url, Map<String, String> bodyMap )
 | 
			
		||||
    {
 | 
			
		||||
        HttpPost post = new HttpPost( url );
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            // 创建参数集合
 | 
			
		||||
            List<BasicNameValuePair> list = new ArrayList<>();
 | 
			
		||||
            // 添加参数
 | 
			
		||||
            if ( bodyMap != null )
 | 
			
		||||
            {
 | 
			
		||||
                for ( String str : bodyMap.keySet() )
 | 
			
		||||
                {
 | 
			
		||||
                    list.add( new BasicNameValuePair( str, bodyMap.get( str ) ) );
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            // 把参数放入请求对象,post发送的参数list,指定格式
 | 
			
		||||
            post.setEntity( new UrlEncodedFormEntity( list, "UTF-8" ) );
 | 
			
		||||
            CloseableHttpClient client = HttpClients.createDefault();
 | 
			
		||||
            // 启动执行请求,并获得返回值
 | 
			
		||||
            CloseableHttpResponse response = client.execute( post );
 | 
			
		||||
            // 得到返回的entity对象
 | 
			
		||||
            HttpEntity entity = response.getEntity();
 | 
			
		||||
            // 把实体对象转换为string
 | 
			
		||||
            return EntityUtils.toString( entity, "UTF-8" );
 | 
			
		||||
        }
 | 
			
		||||
        catch ( Exception e1 )
 | 
			
		||||
        {
 | 
			
		||||
            e1.printStackTrace();
 | 
			
		||||
            return "";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class ResponseResult
 | 
			
		||||
{
 | 
			
		||||
    public ResponseResult() {}
 | 
			
		||||
    
 | 
			
		||||
    public String getCode()
 | 
			
		||||
    {
 | 
			
		||||
        return code;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setCode( String code )
 | 
			
		||||
    {
 | 
			
		||||
        this.code = code;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getMessage()
 | 
			
		||||
    {
 | 
			
		||||
        return message;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setMessage( String message )
 | 
			
		||||
    {
 | 
			
		||||
        this.message = message;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getData()
 | 
			
		||||
    {
 | 
			
		||||
        return data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setData( String data )
 | 
			
		||||
    {
 | 
			
		||||
        this.data = data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getSeqNo()
 | 
			
		||||
    {
 | 
			
		||||
        return seqNo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setSeqNo( String seqNo )
 | 
			
		||||
    {
 | 
			
		||||
        this.seqNo = seqNo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("code")
 | 
			
		||||
    private String code;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("message")
 | 
			
		||||
    private String message;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("data")
 | 
			
		||||
    private String data;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("seqNo")
 | 
			
		||||
    private String seqNo;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,43 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-05-25 15:17:49
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /NewCitizenQueryResult/src/main/java/com/cpic/xim/web/controllers/NewCitizen/IdentifyNewCitizenRequest.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.web.controllers.NewCitizen;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class IdentifyNewCitizenRequest
 | 
			
		||||
{
 | 
			
		||||
    public IdentifyNewCitizenRequest() {}
 | 
			
		||||
 | 
			
		||||
    public String getIdCardNo()
 | 
			
		||||
    {
 | 
			
		||||
        return idCardNo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setIdCardNo( String idCardNo )
 | 
			
		||||
    {
 | 
			
		||||
        this.idCardNo = idCardNo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getName()
 | 
			
		||||
    {
 | 
			
		||||
        return name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setName( String name )
 | 
			
		||||
    {
 | 
			
		||||
        this.name = name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("idcard_no")
 | 
			
		||||
    private String idCardNo;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("name")
 | 
			
		||||
    private String name;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,25 @@
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.web.controllers.NewCitizen;
 | 
			
		||||
 | 
			
		||||
import javax.servlet.http.HttpServletResponse;
 | 
			
		||||
import org.springframework.stereotype.Controller;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
 | 
			
		||||
// 9ILpXKFSHckH1g7h
 | 
			
		||||
 | 
			
		||||
@Controller
 | 
			
		||||
public class QueryResultController
 | 
			
		||||
{
 | 
			
		||||
    @RequestMapping("/save_score.do")
 | 
			
		||||
    public void saveQueryResult(HttpServletResponse response, @RequestBody QueryResultRequest result )
 | 
			
		||||
    {
 | 
			
		||||
        response.setStatus(HttpServletResponse.SC_OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @RequestMapping("/identify.do")
 | 
			
		||||
    public void identifyNewCitizen(@RequestBody IdentifyNewCitizenRequest request )
 | 
			
		||||
    {
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,38 @@
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.web.controllers.NewCitizen;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class QueryResultRequest
 | 
			
		||||
{
 | 
			
		||||
    public QueryResultRequest() {}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public String getIdCardMD5()
 | 
			
		||||
    {
 | 
			
		||||
        return idCardMD5;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setIdCardMD5( String idCardMD5 )
 | 
			
		||||
    {
 | 
			
		||||
        this.idCardMD5 = idCardMD5;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getScore()
 | 
			
		||||
    {
 | 
			
		||||
        return score;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setScore( String score )
 | 
			
		||||
    {
 | 
			
		||||
        this.score = score;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("idcardmd5")
 | 
			
		||||
    private String idCardMD5;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("score")
 | 
			
		||||
    private String score;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,54 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-05-25 11:02:53
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /NewCitizenQueryResult/src/main/java/com/cpic/xim/web/filters/CrosFilter.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.web.filters;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import javax.servlet.Filter;
 | 
			
		||||
import javax.servlet.FilterChain;
 | 
			
		||||
import javax.servlet.ServletException;
 | 
			
		||||
import javax.servlet.ServletRequest;
 | 
			
		||||
import javax.servlet.ServletResponse;
 | 
			
		||||
import javax.servlet.http.HttpServletRequest;
 | 
			
		||||
import javax.servlet.http.HttpServletResponse;
 | 
			
		||||
import org.springframework.http.HttpMethod;
 | 
			
		||||
 | 
			
		||||
public class CrosFilter implements Filter
 | 
			
		||||
{
 | 
			
		||||
    @Override
 | 
			
		||||
    public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain )
 | 
			
		||||
            throws ServletException, IOException
 | 
			
		||||
    {
 | 
			
		||||
        HttpServletRequest request = (HttpServletRequest) req;
 | 
			
		||||
        HttpServletResponse response = (HttpServletResponse) resp;
 | 
			
		||||
        String method = request.getMethod();
 | 
			
		||||
        String originHeader = request.getHeader( "Origin" );
 | 
			
		||||
        
 | 
			
		||||
        System.out.println( "收到" + method + "请求,来自" + originHeader);
 | 
			
		||||
        
 | 
			
		||||
        // 如果是Options请求
 | 
			
		||||
        if ( method.equals(HttpMethod.OPTIONS.toString()) )
 | 
			
		||||
        {
 | 
			
		||||
            originHeader = "*";
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        response.setHeader( "Access-Control-Allow-Origin", originHeader );
 | 
			
		||||
        response.setHeader( "Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT" );
 | 
			
		||||
        response.setHeader( "Access-Control-Max-Age", "0" );
 | 
			
		||||
        response.setHeader( "Access-Control-Allow-Headers",
 | 
			
		||||
                "Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With,userId,token" );
 | 
			
		||||
        response.setHeader( "Access-Control-Allow-Credentials", "true" );
 | 
			
		||||
        response.setHeader( "XDomainRequestAllowed", "1" );
 | 
			
		||||
        response.setHeader( "XDomainRequestAllowed", "1" );
 | 
			
		||||
 | 
			
		||||
        chain.doFilter( request, response );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,50 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-05-25 10:36:14
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @FilePath: /newcitizen/src/test/java/com/cpic/xim/test/NewCitizenQueryResultTest.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.test;
 | 
			
		||||
 | 
			
		||||
import org.junit.Test;
 | 
			
		||||
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
 | 
			
		||||
import org.apache.shiro.crypto.hash.Md5Hash;
 | 
			
		||||
import com.cpic.xim.utils.newcitizen.NewCitizenUitls;
 | 
			
		||||
import com.cpic.xim.utils.newcitizen.IdentifyResult;
 | 
			
		||||
 | 
			
		||||
public class NewCitizenQueryResultTest
 | 
			
		||||
{
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testSaveQueryResult()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testMd5Hash()
 | 
			
		||||
    {
 | 
			
		||||
        String idCardNo = "350402198106130016";
 | 
			
		||||
 | 
			
		||||
        Md5Hash idCardNoHash = new Md5Hash( idCardNo );
 | 
			
		||||
 | 
			
		||||
        System.out.println( "身份证hash值:" + idCardNoHash.toString() );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void testIdentify()
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            IdentifyResult result = NewCitizenUitls.identifyNewCitizen( "350402198106130016", "王炜" );
 | 
			
		||||
        }
 | 
			
		||||
        catch ( Exception error )
 | 
			
		||||
        {
 | 
			
		||||
            System.out.println(error.getMessage());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								文档/2025/厦门信息集团大数据运营有限公司数据服务平台升级通知(修订)(1)(3).doc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								文档/2025/厦门信息集团大数据运营有限公司数据服务平台升级通知(修订)(1)(3).doc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								文档/2025/附件2:厦门信息集团大数据运营有限公司数据服务平台用户操作手册(11).pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								文档/2025/附件2:厦门信息集团大数据运营有限公司数据服务平台用户操作手册(11).pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								文档/government_economic_352.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								文档/government_economic_352.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								文档/新市民接口(#352接口)回调机制补充说明(1).docx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								文档/新市民接口(#352接口)回调机制补充说明(1).docx
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user