diff --git a/code/backend/NewCitizenIdentify/.vscode/settings.json b/code/backend/NewCitizenIdentify/.vscode/settings.json new file mode 100644 index 0000000..0be1c0c --- /dev/null +++ b/code/backend/NewCitizenIdentify/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "java.configuration.updateBuildConfiguration": "automatic", + "java.compile.nullAnalysis.mode": "automatic" +} \ No newline at end of file diff --git a/code/backend/NewCitizenIdentify/pom.xml b/code/backend/NewCitizenIdentify/pom.xml new file mode 100644 index 0000000..3cf3b5a --- /dev/null +++ b/code/backend/NewCitizenIdentify/pom.xml @@ -0,0 +1,173 @@ + + 4.0.0 + com.cpic.xim + NewCitizen + war + 1.0-SNAPSHOT + desktop_archievement_backend Maven Webapp + http://maven.apache.org + + + UTF-8 + 8 + 8 + 6.2.4 + 2.24.3 + 2.18.3 + + + + + + org.slf4j + slf4j-simple + 2.0.17 + test + + + + junit + junit + 4.13.2 + test + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-test + ${spring.version} + test + + + org.springframework + spring-web + ${spring.version} + + + + org.springframework + spring-webmvc + ${spring.version} + + + + + + jakarta.servlet + jakarta.servlet-api + 6.1.0 + provided + + + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + + + org.apache.logging.log4j + log4j-slf4j2-impl + ${log4j.version} + + + org.apache.logging.log4j + log4j-api + ${log4j.version} + + + + org.apache.directory.studio + org.apache.commons.codec + 1.8 + + + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + + + com.mysql + mysql-connector-j + 9.2.0 + + + + org.apache.shiro + shiro-all + 1.11.0 + pom + + + + org.apache.httpcomponents + httpclient + 4.5.14 + + + + org.apache.httpcomponents + httpcore + 4.4.5 + + + + org.apache.commons + commons-lang3 + 3.7 + + + + + NewCitizen + + + org.apache.maven.plugins + maven-war-plugin + 3.2.2 + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M6 + + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 8 + 8 + UTF-8 + + + + + \ No newline at end of file diff --git a/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/config/EncryptionParameters.java b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/config/EncryptionParameters.java new file mode 100644 index 0000000..22dbd3b --- /dev/null +++ b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/config/EncryptionParameters.java @@ -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; + } +} \ No newline at end of file diff --git a/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/newcitizen/IdentifyResult.java b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/newcitizen/IdentifyResult.java new file mode 100644 index 0000000..9bf842f --- /dev/null +++ b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/newcitizen/IdentifyResult.java @@ -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; +} \ No newline at end of file diff --git a/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/newcitizen/NewCitizenUitls.java b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/newcitizen/NewCitizenUitls.java new file mode 100644 index 0000000..7641ff2 --- /dev/null +++ b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/newcitizen/NewCitizenUitls.java @@ -0,0 +1,187 @@ +/* + * @Author: Kane + * + * @Date: 2023-05-25 15:26:09 + * + * @LastEditors: Kane + * + * @FilePath: /NewCitizenQueryResult/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.EncryptionUtils; +// import com.cdp.product.security.sign.CdpSignUtil; +import com.cpic.xim.utils.security.encode.EncryptionUtils; +import com.cpic.xim.utils.security.decode.DecryptionUtils; +import com.cpic.xim.utils.security.sign.SignUtils; +import com.cpic.xim.utils.config.EncryptionParameters; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonParseException; +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 param = new HashMap(); + + 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 params = new HashMap<>(); + + params.putAll( param ); + params.put( "key", key ); + params.put( "sign", sign ); + + String resultJSON = 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; + } + + public static String sendPost( String url, Map bodyMap ) + { + HttpPost post = new HttpPost( url ); + + try + { + // 创建参数集合 + List 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; +} + diff --git a/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/security/decode/DecryptionUtils.java b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/security/decode/DecryptionUtils.java new file mode 100644 index 0000000..9885bc9 --- /dev/null +++ b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/security/decode/DecryptionUtils.java @@ -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; + } +} diff --git a/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/security/encode/EncryptionUtils.java b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/security/encode/EncryptionUtils.java new file mode 100644 index 0000000..6a108ac --- /dev/null +++ b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/security/encode/EncryptionUtils.java @@ -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( "加密失败!" ); + } + } +} diff --git a/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/security/sign/SignUtils.java b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/security/sign/SignUtils.java new file mode 100644 index 0000000..cdc44bb --- /dev/null +++ b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/utils/security/sign/SignUtils.java @@ -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 param ) throws Exception + { + try + { + Set 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( "签名失败!" ); + } + } +} diff --git a/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/controllers/NewCitizen/IdentifyNewCitizenRequest.java b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/controllers/NewCitizen/IdentifyNewCitizenRequest.java new file mode 100644 index 0000000..d64144c --- /dev/null +++ b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/controllers/NewCitizen/IdentifyNewCitizenRequest.java @@ -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; +} \ No newline at end of file diff --git a/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/controllers/NewCitizen/IdentifyNewCitizenResponse.java b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/controllers/NewCitizen/IdentifyNewCitizenResponse.java new file mode 100644 index 0000000..603724b --- /dev/null +++ b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/controllers/NewCitizen/IdentifyNewCitizenResponse.java @@ -0,0 +1,82 @@ +/* + * @Author: Kane + * @Date: 2023-05-25 20:26:06 + * @LastEditors: Kane + * @FilePath: /NewCitizenQueryResult/src/main/java/com/cpic/xim/web/controllers/NewCitizen/IdentifyNewCitizenResult.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 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; +} \ No newline at end of file diff --git a/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/controllers/NewCitizen/QueryResultController.java b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/controllers/NewCitizen/QueryResultController.java new file mode 100644 index 0000000..7135235 --- /dev/null +++ b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/controllers/NewCitizen/QueryResultController.java @@ -0,0 +1,61 @@ +/* + * @Author: Kane + * @Date: 2023-05-25 12:09:27 + * @LastEditors: Kane + * @FilePath: /NewCitizenQueryResult/src/main/java/com/cpic/xim/web/controllers/NewCitizen/QueryResultController.java + * @Description: + * + * Copyright (c) ${2022} 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; + } +} \ No newline at end of file diff --git a/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/controllers/NewCitizen/QueryResultRequest.java b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/controllers/NewCitizen/QueryResultRequest.java new file mode 100644 index 0000000..f764cbe --- /dev/null +++ b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/controllers/NewCitizen/QueryResultRequest.java @@ -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; +} \ No newline at end of file diff --git a/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/filters/CrosFilter.java b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/filters/CrosFilter.java new file mode 100644 index 0000000..593e014 --- /dev/null +++ b/code/backend/NewCitizenIdentify/src/main/java/com/cpic/xim/web/filters/CrosFilter.java @@ -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 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 ); + } + +} diff --git a/code/backend/NewCitizenQueryResult/src/main/webapp/classes/spring.xml b/code/backend/NewCitizenIdentify/src/main/webapp/WEB-INF/classes/spring.xml similarity index 92% rename from code/backend/NewCitizenQueryResult/src/main/webapp/classes/spring.xml rename to code/backend/NewCitizenIdentify/src/main/webapp/WEB-INF/classes/spring.xml index a349f68..595cc04 100644 --- a/code/backend/NewCitizenQueryResult/src/main/webapp/classes/spring.xml +++ b/code/backend/NewCitizenIdentify/src/main/webapp/WEB-INF/classes/spring.xml @@ -17,21 +17,20 @@ 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"> - - + - + - - + --> \ No newline at end of file diff --git a/code/backend/NewCitizenQueryResult/src/main/webapp/WEB-INF/web.xml b/code/backend/NewCitizenIdentify/src/main/webapp/WEB-INF/web.xml similarity index 86% rename from code/backend/NewCitizenQueryResult/src/main/webapp/WEB-INF/web.xml rename to code/backend/NewCitizenIdentify/src/main/webapp/WEB-INF/web.xml index ab3bedc..11e2001 100644 --- a/code/backend/NewCitizenQueryResult/src/main/webapp/WEB-INF/web.xml +++ b/code/backend/NewCitizenIdentify/src/main/webapp/WEB-INF/web.xml @@ -18,10 +18,6 @@ springmvc *.do - - springmvc - /account/p13_account_check - CrosFilter diff --git a/code/backend/NewCitizenQueryResult/src/main/webapp/index.jsp b/code/backend/NewCitizenIdentify/src/main/webapp/index.jsp similarity index 100% rename from code/backend/NewCitizenQueryResult/src/main/webapp/index.jsp rename to code/backend/NewCitizenIdentify/src/main/webapp/index.jsp diff --git a/code/backend/NewCitizenIdentify/src/test/java/com/cpic/xim/test/NewCitizenQueryResultTest.java b/code/backend/NewCitizenIdentify/src/test/java/com/cpic/xim/test/NewCitizenQueryResultTest.java new file mode 100644 index 0000000..0111a61 --- /dev/null +++ b/code/backend/NewCitizenIdentify/src/test/java/com/cpic/xim/test/NewCitizenQueryResultTest.java @@ -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 ); + } + } +} diff --git a/code/backend/NewCitizenQueryResult/.vscode/settings.json b/code/backend/NewCitizenQueryResult/.vscode/settings.json deleted file mode 100644 index c5f3f6b..0000000 --- a/code/backend/NewCitizenQueryResult/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "java.configuration.updateBuildConfiguration": "interactive" -} \ No newline at end of file diff --git a/code/backend/NewCitizenQueryResult/src/test/java/com/cpic/xim/test/NewCitizenQueryResultTest.java b/code/backend/NewCitizenQueryResult/src/test/java/com/cpic/xim/test/NewCitizenQueryResultTest.java deleted file mode 100644 index e6c154f..0000000 --- a/code/backend/NewCitizenQueryResult/src/test/java/com/cpic/xim/test/NewCitizenQueryResultTest.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * @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; - -public class NewCitizenQueryResultTest -{ - @Test - public void testSaveQueryResult() - { - - } -} \ No newline at end of file diff --git a/code/console/newcitizen/.vscode/settings.json b/code/console/newcitizen/.vscode/settings.json new file mode 100644 index 0000000..0be1c0c --- /dev/null +++ b/code/console/newcitizen/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "java.configuration.updateBuildConfiguration": "automatic", + "java.compile.nullAnalysis.mode": "automatic" +} \ No newline at end of file diff --git a/code/backend/NewCitizenQueryResult/pom.xml b/code/console/newcitizen/pom.xml similarity index 61% rename from code/backend/NewCitizenQueryResult/pom.xml rename to code/console/newcitizen/pom.xml index b79b43b..d037351 100644 --- a/code/backend/NewCitizenQueryResult/pom.xml +++ b/code/console/newcitizen/pom.xml @@ -1,20 +1,21 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + com.cpic.xim - desktop_archievement_backend - war + newcitizen 1.0-SNAPSHOT - desktop_archievement_backend Maven Webapp + jar + + newcitizen http://maven.apache.org UTF-8 - 17 - 17 + 1.8 + 1.8 5.3.24 - @@ -25,6 +26,7 @@ 4.13.2 test + org.springframework spring-context @@ -92,14 +94,62 @@ ojdbc8 19.3.0.0.0 + + + org.apache.shiro + shiro-all + 1.11.0 + pom + + + + + + + + org.apache.httpcomponents + httpclient + 4.5.14 + + + + org.apache.httpcomponents + httpcore + 4.4.5 + + + + org.apache.commons + commons-lang3 + 3.7 + + - desktop_archievement_backend + compile org.apache.maven.plugins - maven-war-plugin - 3.2.2 + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + UTF-8 + + ${project.basedir}\lib + + org.apache.maven.plugins @@ -111,13 +161,26 @@ org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 + maven-assembly-plugin - 17 - 17 - UTF-8 + + jar-with-dependencies + + + + AppMain + + + + + make-assmenbly + package + + single + + + diff --git a/code/console/newcitizen/src/main/java/com/cpic/xim/App.java b/code/console/newcitizen/src/main/java/com/cpic/xim/App.java new file mode 100644 index 0000000..dc75339 --- /dev/null +++ b/code/console/newcitizen/src/main/java/com/cpic/xim/App.java @@ -0,0 +1,13 @@ +package com.cpic.xim; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/code/console/newcitizen/src/main/java/com/cpic/xim/utils/config/EncryptionParameters.java b/code/console/newcitizen/src/main/java/com/cpic/xim/utils/config/EncryptionParameters.java new file mode 100644 index 0000000..22dbd3b --- /dev/null +++ b/code/console/newcitizen/src/main/java/com/cpic/xim/utils/config/EncryptionParameters.java @@ -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; + } +} \ No newline at end of file diff --git a/code/console/newcitizen/src/main/java/com/cpic/xim/utils/decryption/DecryptionUtils.java b/code/console/newcitizen/src/main/java/com/cpic/xim/utils/decryption/DecryptionUtils.java new file mode 100644 index 0000000..792b219 --- /dev/null +++ b/code/console/newcitizen/src/main/java/com/cpic/xim/utils/decryption/DecryptionUtils.java @@ -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 ); + } +} diff --git a/code/console/newcitizen/src/main/java/com/cpic/xim/utils/encryption/EncryptionUtils.java b/code/console/newcitizen/src/main/java/com/cpic/xim/utils/encryption/EncryptionUtils.java new file mode 100644 index 0000000..a129ba4 --- /dev/null +++ b/code/console/newcitizen/src/main/java/com/cpic/xim/utils/encryption/EncryptionUtils.java @@ -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; + } +} \ No newline at end of file diff --git a/code/console/newcitizen/src/main/java/com/cpic/xim/utils/newcitizen/IdentifyResult.java b/code/console/newcitizen/src/main/java/com/cpic/xim/utils/newcitizen/IdentifyResult.java new file mode 100644 index 0000000..9bf842f --- /dev/null +++ b/code/console/newcitizen/src/main/java/com/cpic/xim/utils/newcitizen/IdentifyResult.java @@ -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; +} \ No newline at end of file diff --git a/code/console/newcitizen/src/main/java/com/cpic/xim/utils/newcitizen/NewCitizenUitls.java b/code/console/newcitizen/src/main/java/com/cpic/xim/utils/newcitizen/NewCitizenUitls.java new file mode 100644 index 0000000..ff2d578 --- /dev/null +++ b/code/console/newcitizen/src/main/java/com/cpic/xim/utils/newcitizen/NewCitizenUitls.java @@ -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 param = new HashMap(); + + 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 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 bodyMap ) + { + HttpPost post = new HttpPost( url ); + + try + { + // 创建参数集合 + List 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; +} + + diff --git a/code/console/newcitizen/src/main/java/com/cpic/xim/web/controllers/NewCitizen/IdentifyNewCitizenRequest.java b/code/console/newcitizen/src/main/java/com/cpic/xim/web/controllers/NewCitizen/IdentifyNewCitizenRequest.java new file mode 100644 index 0000000..d64144c --- /dev/null +++ b/code/console/newcitizen/src/main/java/com/cpic/xim/web/controllers/NewCitizen/IdentifyNewCitizenRequest.java @@ -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; +} \ No newline at end of file diff --git a/code/console/newcitizen/src/main/java/com/cpic/xim/web/controllers/NewCitizen/QueryResultController.java b/code/console/newcitizen/src/main/java/com/cpic/xim/web/controllers/NewCitizen/QueryResultController.java new file mode 100644 index 0000000..df39087 --- /dev/null +++ b/code/console/newcitizen/src/main/java/com/cpic/xim/web/controllers/NewCitizen/QueryResultController.java @@ -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 ) + { + + } +} \ No newline at end of file diff --git a/code/console/newcitizen/src/main/java/com/cpic/xim/web/controllers/NewCitizen/QueryResultRequest.java b/code/console/newcitizen/src/main/java/com/cpic/xim/web/controllers/NewCitizen/QueryResultRequest.java new file mode 100644 index 0000000..f764cbe --- /dev/null +++ b/code/console/newcitizen/src/main/java/com/cpic/xim/web/controllers/NewCitizen/QueryResultRequest.java @@ -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; +} \ No newline at end of file diff --git a/code/backend/NewCitizenQueryResult/src/main/java/com/cpic/xim/web/filters/CrosFilter.java b/code/console/newcitizen/src/main/java/com/cpic/xim/web/filters/CrosFilter.java similarity index 86% rename from code/backend/NewCitizenQueryResult/src/main/java/com/cpic/xim/web/filters/CrosFilter.java rename to code/console/newcitizen/src/main/java/com/cpic/xim/web/filters/CrosFilter.java index ba342fc..d218312 100644 --- a/code/backend/NewCitizenQueryResult/src/main/java/com/cpic/xim/web/filters/CrosFilter.java +++ b/code/console/newcitizen/src/main/java/com/cpic/xim/web/filters/CrosFilter.java @@ -7,16 +7,8 @@ * * Copyright (c) ${2022} by Kane, All Rights Reserved. */ -/* - * @Author: Kane - * @Date: 2023-02-28 22:52:32 - * @LastEditors: Kane - * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/filters/cros/CrosFilter.java - * @Description: - * - * Copyright (c) ${2022} by Kane, All Rights Reserved. - */ -package com.cpic.xim.web.filters.cros; + +package com.cpic.xim.web.filters; import java.io.IOException; import javax.servlet.Filter; diff --git a/code/console/newcitizen/src/test/java/com/cpic/xim/test/NewCitizenQueryResultTest.java b/code/console/newcitizen/src/test/java/com/cpic/xim/test/NewCitizenQueryResultTest.java new file mode 100644 index 0000000..3719398 --- /dev/null +++ b/code/console/newcitizen/src/test/java/com/cpic/xim/test/NewCitizenQueryResultTest.java @@ -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()); + } + } +} diff --git a/文档/2025/厦门信息集团大数据运营有限公司数据服务平台升级通知(修订)(1)(3).doc b/文档/2025/厦门信息集团大数据运营有限公司数据服务平台升级通知(修订)(1)(3).doc new file mode 100644 index 0000000..6f8425d Binary files /dev/null and b/文档/2025/厦门信息集团大数据运营有限公司数据服务平台升级通知(修订)(1)(3).doc differ diff --git a/文档/2025/附件2:厦门信息集团大数据运营有限公司数据服务平台用户操作手册(11).pdf b/文档/2025/附件2:厦门信息集团大数据运营有限公司数据服务平台用户操作手册(11).pdf new file mode 100644 index 0000000..efbe979 Binary files /dev/null and b/文档/2025/附件2:厦门信息集团大数据运营有限公司数据服务平台用户操作手册(11).pdf differ diff --git a/文档/government_economic_352.pdf b/文档/government_economic_352.pdf new file mode 100644 index 0000000..a647bb7 Binary files /dev/null and b/文档/government_economic_352.pdf differ diff --git a/文档/新市民接口(#352接口)回调机制补充说明(1).docx b/文档/新市民接口(#352接口)回调机制补充说明(1).docx new file mode 100644 index 0000000..c466fb1 Binary files /dev/null and b/文档/新市民接口(#352接口)回调机制补充说明(1).docx differ