新建项目
This commit is contained in:
		
							
								
								
									
										3
									
								
								code/backend/NewCitizenQueryResult/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								code/backend/NewCitizenQueryResult/.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
{
 | 
			
		||||
    "java.configuration.updateBuildConfiguration": "interactive"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										124
									
								
								code/backend/NewCitizenQueryResult/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										124
									
								
								code/backend/NewCitizenQueryResult/pom.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,124 @@
 | 
			
		||||
<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>desktop_archievement_backend</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>17</maven.compiler.source>
 | 
			
		||||
    <maven.compiler.target>17</maven.compiler.target>
 | 
			
		||||
    <spring.version>5.3.24</spring.version>
 | 
			
		||||
    <!-- <spring.version>6.0.8</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>
 | 
			
		||||
  </dependencies>
 | 
			
		||||
  <build>
 | 
			
		||||
    <finalName>desktop_archievement_backend</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>17</source>
 | 
			
		||||
          <target>17</target>
 | 
			
		||||
          <encoding>UTF-8</encoding>
 | 
			
		||||
        </configuration>
 | 
			
		||||
      </plugin>
 | 
			
		||||
    </plugins>
 | 
			
		||||
  </build>
 | 
			
		||||
</project>
 | 
			
		||||
@@ -0,0 +1,62 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @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. 
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * @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;
 | 
			
		||||
 | 
			
		||||
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,35 @@
 | 
			
		||||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
 | 
			
		||||
  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_3_1.xsd"
 | 
			
		||||
  version="3.1">
 | 
			
		||||
 | 
			
		||||
  <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>
 | 
			
		||||
  <servlet-mapping>
 | 
			
		||||
    <servlet-name>springmvc</servlet-name>
 | 
			
		||||
    <url-pattern>/account/p13_account_check</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,37 @@
 | 
			
		||||
<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">
 | 
			
		||||
 | 
			
		||||
    <context:component-scan base-package="com.cpic.xim" />
 | 
			
		||||
    <mvc:annotation-driven />
 | 
			
		||||
    <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,5 @@
 | 
			
		||||
<html>
 | 
			
		||||
<body>
 | 
			
		||||
<h2>Hello World!</h2>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @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()
 | 
			
		||||
    {
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user