完成后端查询员工信息功能

This commit is contained in:
Kane 2023-03-01 00:20:47 +08:00
parent 1fa3b7cfdc
commit 65a51efa30
15 changed files with 5307 additions and 4710 deletions

View File

View File

@ -1,13 +1,22 @@
<!--
* @Author: Kane
* @Date: 2023-02-28 00:12:43
* @LastEditors: Kane
* @FilePath: /task_schedule/index.html
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>看看你的业绩!!!</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

View File

@ -2,8 +2,8 @@
* @Author: Kane
* @Date: 2023-02-15 09:25:52
* @LastEditors: Kane
* @LastEditTime: 2023-02-28 19:05:15
* @FilePath: /deskop_task_schedule/code/web/task_schedule/src/App.vue
* @LastEditTime: 2023-02-28 22:15:53
* @FilePath: /task_schedule/src/App.vue
* @Description:
* 应用的框架
* 1配置el-config-provider配置为中文
@ -31,35 +31,5 @@ export default {
};
</script>
<style scoped>
.app_wrapper {
box-sizing: border-box;
width: 100%;
height: calc(100vh - 60px);
/* border: 1px solid brown; */
/* 布局 */
display: flex;
}
.counter_wrapper {
width: 500px;
margin-top: 1cm;
margin-left: auto;
margin-right: 1cm;
border-radius: 5px;
background-color: rgb(250 250 250 / 75%);
}
.counter_wrapper:hover {
box-shadow: 0px 0px 20px 10px rgb(14 18 22 / 10%);
}
.counter_wrapper span {
display: block;
font-size: 150px;
text-align: right;
}
</style>
<style scoped></style>

View File

@ -2,31 +2,40 @@
* @Author: Kane
* @Date: 2023-02-15 09:25:52
* @LastEditors: Kane
* @LastEditTime: 2023-02-28 19:22:19
* @LastEditTime: 2023-02-28 22:36:10
* @FilePath: /task_schedule/vite.config.js
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
import { defineConfig } from 'vite';
import { defineConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(),],
base: './',
resolve: {
//配置别名
alias: [
{
find: /^~/,
replacement: '',
},
{
find: '@',
replacement: path.resolve(__dirname, 'src'),
},
],
},
});
export default defineConfig((command, mode) =>
{
const env = loadEnv(mode, process.cwd(), '');
return {
plugins: [vue(),],
base: './',
resolve: {
//配置别名
alias: [
{
find: /^~/,
replacement: '',
},
{
find: '@',
replacement: path.resolve(__dirname, 'src'),
},
],
},
define: {
__APP_ENV__: env.APP_ENV,
},
};
}
);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}

View File

@ -0,0 +1,107 @@
<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>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<spring.version>5.3.24</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</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-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>
</plugins>
</build>
</project>

View File

@ -0,0 +1,210 @@
/*
* @Author: Kane
* @Date: 2022-12-15 14:08:28
* @LastEditors: Kane
* @LastEditTime: 2023-02-28 23:24:07
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/utils/account/CpicXIMStaffInfo.java
* @Description: 产险厦门分公司员工信息对象
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
package com.cpic.xim.utils.account;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.fasterxml.jackson.annotation.JsonProperty;
/*****************************************************
* 厦门太保员工信息
* 使用工厂函数创建
*****************************************************/
public class CpicXIMStaffInfo
{
/*****************************************************
* 查询员工信息
* @param uidOrCode p13账号或p09账号
* @return 员工信息对象
*****************************************************/
public static CpicXIMStaffInfo getStaffInfo( String uidOrCode )
throws SQLException, ClassNotFoundException
{
CpicXIMStaffInfo info = null;
Connection connection = null;
PreparedStatement stmt = null;
ResultSet result = null;
String jdbcURL = "jdbc:oracle:thin:@10.39.0.86:1521:xmcx1";
String userName = "dataex";
String password = "cpic123456";
String querySQL = "SELECT ry.staff_code,ry.staff_name,ry.p13uid,"
+ " ry.department_code, bm.department_name,"
+ " ry.section_office_code,ks.section_office_name "
+ " FROM idst0.rydm_t ry,idst0.ks_t ks,idst0.bm_t bm "
+ " WHERE ry.account_status = 0 AND (ry.staff_code = ? OR ry.p13uid = ?) "
+ " and ry.section_office_code = ks.section_office_code "
+ " and ry.department_code = bm.department_code ";
try
{
Class.forName( "oracle.jdbc.driver.OracleDriver" );
connection = DriverManager.getConnection( jdbcURL, userName, password );
stmt = connection.prepareStatement( querySQL );
stmt.setString( 1, uidOrCode );
stmt.setString( 2, uidOrCode );
result = stmt.executeQuery();
if ( result.next() )
{
info = new CpicXIMStaffInfo();
info.code = result.getString( 1 );
info.name = result.getString( 2 );
info.p13UID = result.getString( 3 );
info.departmentCode = result.getString( 4 );
info.departmentName = result.getString( 5 );
info.sectionOfficeCode = result.getString( 6 );
info.setctionOfficeName = result.getString( 7 );
}
}
finally
{
try
{
if ( result != null )
{
result.close();
}
}
catch ( Exception exception )
{
exception.printStackTrace();
}
try
{
if ( stmt != null )
{
stmt.close();
}
}
catch ( Exception exception )
{
exception.printStackTrace();
}
try
{
if ( connection != null )
{
connection.close();
}
}
catch ( Exception exception )
{
exception.printStackTrace();
}
}
return info;
}
private CpicXIMStaffInfo()
{}
public String getName()
{
return name;
}
public void setName( String name )
{
this.name = name;
}
public String getCode()
{
return code;
}
public void setCode( String code )
{
this.code = code;
}
public String getP13UID()
{
return p13UID;
}
public void setP13UID( String p13uid )
{
p13UID = p13uid;
}
public String getDepartmentCode()
{
return departmentCode;
}
public void setDepartmentCode( String departmentCode )
{
this.departmentCode = departmentCode;
}
public String getDepartmentName()
{
return departmentName;
}
public void setDepartmentName( String departmentName )
{
this.departmentName = departmentName;
}
public String getSectionOfficeCode()
{
return sectionOfficeCode;
}
public void setSectionOfficeCode( String sectionOfficeCode )
{
this.sectionOfficeCode = sectionOfficeCode;
}
public String getSetctionOfficeName()
{
return setctionOfficeName;
}
public void setSetctionOfficeName( String setctionOfficeName )
{
this.setctionOfficeName = setctionOfficeName;
}
@JsonProperty( "name" )
private String name;
@JsonProperty( "code" )
private String code;
@JsonProperty( "p13uid" )
private String p13UID;
@JsonProperty( "department_code" )
private String departmentCode;
@JsonProperty( "department_name" )
private String departmentName;
@JsonProperty( "section_office_code" )
private String sectionOfficeCode;
@JsonProperty( "section_office_name" )
private String setctionOfficeName;
}

View File

@ -0,0 +1,52 @@
/*
* @Author: Kane
* @Date: 2023-02-28 23:13:51
* @LastEditors: Kane
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/account/StaffInfoQueryController.java
* @Description: 员工信息查询controller
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
package com.cpic.xim.web.controllers.account;
import java.sql.SQLException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.cpic.xim.utils.account.CpicXIMStaffInfo;
@Controller
@RequestMapping( "/account" )
public class StaffInfoQueryController
{
@RequestMapping( "/query_staff_info.do" )
@ResponseBody
public StaffInfoQueryResult queryStaffInfo( @RequestParam( "account" ) String account )
{
StaffInfoQueryResult result = new StaffInfoQueryResult();
CpicXIMStaffInfo staffInfo = null;
try
{
staffInfo = CpicXIMStaffInfo.getStaffInfo( account );
result.setStaffInfo( staffInfo );
result.setSuccess( true );
result.setMessage( "查询成功" );
}
catch ( SQLException error )
{
result.setSuccess( false );
result.setMessage( error.getMessage() );
}
catch ( ClassNotFoundException error )
{
result.setSuccess( false );
result.setMessage( error.getMessage() );
}
return result;
}
}

View File

@ -0,0 +1,111 @@
/*
* @Author: Kane
* @Date: 2022-12-15 11:17:26
* @LastEditors: Kane
* @LastEditTime: 2023-01-10 14:58:53
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\controllers\account\P13AccountCheckResult.java
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
package com.cpic.xim.web.controllers.account;
import com.cpic.xim.utils.account.CpicXIMStaffInfo;
import com.fasterxml.jackson.annotation.*;;
public class StaffInfoQueryResult
{
StaffInfoQueryResult()
{}
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 CpicXIMStaffInfo getStaffInfo()
{
return staffInfo;
}
public void setStaffInfo( CpicXIMStaffInfo staffInfo )
{
this.staffInfo = staffInfo;
}
public String getToken()
{
return token;
}
public void setToken( String token )
{
this.token = token;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + (success ? 1231 : 1237);
result = prime * result + ((message == null) ? 0 : message.hashCode());
return result;
}
@Override
public boolean equals( Object obj )
{
if ( this == obj )
return true;
if ( obj == null )
return false;
if ( getClass() != obj.getClass() )
return false;
StaffInfoQueryResult other = (StaffInfoQueryResult) obj;
if ( success != other.success )
return false;
if ( message == null )
{
if ( other.message != null )
return false;
}
else if ( !message.equals( other.message ) )
return false;
return true;
}
// 验证结果状态true为成功false为失败
@JsonProperty( "success" )
private boolean success;
// 验证结果消息字符串用来提示前端
@JsonProperty( "message" )
private String message;
// 用户的token
@JsonProperty( "token" )
private String token;
// 验证成功后查询到的人员信息
@JsonProperty( "staff_info" )
CpicXIMStaffInfo staffInfo;
}

View File

@ -0,0 +1,43 @@
/*
* @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;
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 originHeader = request.getHeader( "Origin" );
response.setHeader( "Access-Control-Allow-Origin", originHeader );
response.setHeader( "Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE" );
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 );
}
}

View File

@ -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>

View File

@ -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.cros.CrosFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CrosFilter</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
</web-app>

View File

@ -0,0 +1,5 @@
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>

6
package-lock.json generated Normal file
View File

@ -0,0 +1,6 @@
{
"name": "desktop_task_schedule",
"lockfileVersion": 2,
"requires": true,
"packages": {}
}