修改了CROS的代码,options请求的origin为*。

This commit is contained in:
Kane Wang 2023-05-17 20:24:44 +08:00
parent 21732f6bd2
commit 34c60ada3e
7 changed files with 126 additions and 66 deletions

View File

@ -10,8 +10,8 @@
"dependencies": {
"@babel/eslint-parser": "^7.21.8",
"@element-plus/icons-vue": "^2.1.0",
"@typescript-eslint/eslint-plugin": "^5.59.5",
"@typescript-eslint/parser": "^5.59.5",
"@typescript-eslint/eslint-plugin": "^5.59.6",
"@typescript-eslint/parser": "^5.59.6",
"axios": "^1.4.0",
"babel": "^6.23.0",
"echarts": "^5.4.2",
@ -28,7 +28,7 @@
"eslint": "^8.40.0",
"eslint-config-recommended": "^4.1.0",
"eslint-config-standard-with-typescript": "^34.0.1",
"eslint-plugin-vue": "^9.12.0",
"eslint-plugin-vue": "^9.13.0",
"sass": "^1.62.1",
"typescript": "^5.0.4",
"vue-eslint-parser": "^9.3.0"
@ -1428,14 +1428,14 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.59.5",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.5.tgz",
"integrity": "sha512-feA9xbVRWJZor+AnLNAr7A8JRWeZqHUf4T9tlP+TN04b05pFVhO5eN7/O93Y/1OUlLMHKbnJisgDURs/qvtqdg==",
"version": "5.59.6",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.6.tgz",
"integrity": "sha512-sXtOgJNEuRU5RLwPUb1jxtToZbgvq3M6FPpY4QENxoOggK+UpTxUBpj6tD8+Qh2g46Pi9We87E+eHnUw8YcGsw==",
"dependencies": {
"@eslint-community/regexpp": "^4.4.0",
"@typescript-eslint/scope-manager": "5.59.5",
"@typescript-eslint/type-utils": "5.59.5",
"@typescript-eslint/utils": "5.59.5",
"@typescript-eslint/scope-manager": "5.59.6",
"@typescript-eslint/type-utils": "5.59.6",
"@typescript-eslint/utils": "5.59.6",
"debug": "^4.3.4",
"grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
@ -1487,13 +1487,13 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/@typescript-eslint/parser": {
"version": "5.59.5",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/parser/-/parser-5.59.5.tgz",
"integrity": "sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw==",
"version": "5.59.6",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/parser/-/parser-5.59.6.tgz",
"integrity": "sha512-7pCa6al03Pv1yf/dUg/s1pXz/yGMUBAw5EeWqNTFiSueKvRNonze3hma3lhdsOrQcaOXhbk5gKu2Fludiho9VA==",
"dependencies": {
"@typescript-eslint/scope-manager": "5.59.5",
"@typescript-eslint/types": "5.59.5",
"@typescript-eslint/typescript-estree": "5.59.5",
"@typescript-eslint/scope-manager": "5.59.6",
"@typescript-eslint/types": "5.59.6",
"@typescript-eslint/typescript-estree": "5.59.6",
"debug": "^4.3.4"
},
"engines": {
@ -1509,24 +1509,24 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "5.59.5",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.5.tgz",
"integrity": "sha512-jVecWwnkX6ZgutF+DovbBJirZcAxgxC0EOHYt/niMROf8p4PwxxG32Qdhj/iIQQIuOflLjNkxoXyArkcIP7C3A==",
"version": "5.59.6",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.6.tgz",
"integrity": "sha512-gLbY3Le9Dxcb8KdpF0+SJr6EQ+hFGYFl6tVY8VxLPFDfUZC7BHFw+Vq7bM5lE9DwWPfx4vMWWTLGXgpc0mAYyQ==",
"dependencies": {
"@typescript-eslint/types": "5.59.5",
"@typescript-eslint/visitor-keys": "5.59.5"
"@typescript-eslint/types": "5.59.6",
"@typescript-eslint/visitor-keys": "5.59.6"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "5.59.5",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/type-utils/-/type-utils-5.59.5.tgz",
"integrity": "sha512-4eyhS7oGym67/pSxA2mmNq7X164oqDYNnZCUayBwJZIRVvKpBCMBzFnFxjeoDeShjtO6RQBHBuwybuX3POnDqg==",
"version": "5.59.6",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/type-utils/-/type-utils-5.59.6.tgz",
"integrity": "sha512-A4tms2Mp5yNvLDlySF+kAThV9VTBPCvGf0Rp8nl/eoDX9Okun8byTKoj3fJ52IJitjWOk0fKPNQhXEB++eNozQ==",
"dependencies": {
"@typescript-eslint/typescript-estree": "5.59.5",
"@typescript-eslint/utils": "5.59.5",
"@typescript-eslint/typescript-estree": "5.59.6",
"@typescript-eslint/utils": "5.59.6",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
},
@ -1543,20 +1543,20 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "5.59.5",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/types/-/types-5.59.5.tgz",
"integrity": "sha512-xkfRPHbqSH4Ggx4eHRIO/eGL8XL4Ysb4woL8c87YuAo8Md7AUjyWKa9YMwTL519SyDPrfEgKdewjkxNCVeJW7w==",
"version": "5.59.6",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/types/-/types-5.59.6.tgz",
"integrity": "sha512-tH5lBXZI7T2MOUgOWFdVNUILsI02shyQvfzG9EJkoONWugCG77NDDa1EeDGw7oJ5IvsTAAGVV8I3Tk2PNu9QfA==",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "5.59.5",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.5.tgz",
"integrity": "sha512-+XXdLN2CZLZcD/mO7mQtJMvCkzRfmODbeSKuMY/yXbGkzvA9rJyDY5qDYNoiz2kP/dmyAxXquL2BvLQLJFPQIg==",
"version": "5.59.6",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.6.tgz",
"integrity": "sha512-vW6JP3lMAs/Tq4KjdI/RiHaaJSO7IUsbkz17it/Rl9Q+WkQ77EOuOnlbaU8kKfVIOJxMhnRiBG+olE7f3M16DA==",
"dependencies": {
"@typescript-eslint/types": "5.59.5",
"@typescript-eslint/visitor-keys": "5.59.5",
"@typescript-eslint/types": "5.59.6",
"@typescript-eslint/visitor-keys": "5.59.6",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@ -1584,9 +1584,9 @@
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/semver": {
"version": "7.5.0",
"resolved": "https://registry.npmmirror.com/semver/-/semver-7.5.0.tgz",
"integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==",
"version": "7.5.1",
"resolved": "https://registry.npmmirror.com/semver/-/semver-7.5.1.tgz",
"integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==",
"dependencies": {
"lru-cache": "^6.0.0"
},
@ -1603,16 +1603,16 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/@typescript-eslint/utils": {
"version": "5.59.5",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/utils/-/utils-5.59.5.tgz",
"integrity": "sha512-sCEHOiw+RbyTii9c3/qN74hYDPNORb8yWCoPLmB7BIflhplJ65u2PBpdRla12e3SSTJ2erRkPjz7ngLHhUegxA==",
"version": "5.59.6",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/utils/-/utils-5.59.6.tgz",
"integrity": "sha512-vzaaD6EXbTS29cVH0JjXBdzMt6VBlv+hE31XktDRMX1j3462wZCJa7VzO2AxXEXcIl8GQqZPcOPuW/Z1tZVogg==",
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@types/json-schema": "^7.0.9",
"@types/semver": "^7.3.12",
"@typescript-eslint/scope-manager": "5.59.5",
"@typescript-eslint/types": "5.59.5",
"@typescript-eslint/typescript-estree": "5.59.5",
"@typescript-eslint/scope-manager": "5.59.6",
"@typescript-eslint/types": "5.59.6",
"@typescript-eslint/typescript-estree": "5.59.6",
"eslint-scope": "^5.1.1",
"semver": "^7.3.7"
},
@ -1635,9 +1635,9 @@
}
},
"node_modules/@typescript-eslint/utils/node_modules/semver": {
"version": "7.5.0",
"resolved": "https://registry.npmmirror.com/semver/-/semver-7.5.0.tgz",
"integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==",
"version": "7.5.1",
"resolved": "https://registry.npmmirror.com/semver/-/semver-7.5.1.tgz",
"integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==",
"dependencies": {
"lru-cache": "^6.0.0"
},
@ -1654,11 +1654,11 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "5.59.5",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.5.tgz",
"integrity": "sha512-qL+Oz+dbeBRTeyJTIy0eniD3uvqU7x+y1QceBismZ41hd4aBSRh8UAw4pZP0+XzLuPZmx4raNMq/I+59W2lXKA==",
"version": "5.59.6",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.6.tgz",
"integrity": "sha512-zEfbFLzB9ETcEJ4HZEEsCR9HHeNku5/Qw1jSS5McYJv5BR+ftYXwFFAH5Al+xkGaZEqowMwl7uoJjQb1YSPF8Q==",
"dependencies": {
"@typescript-eslint/types": "5.59.5",
"@typescript-eslint/types": "5.59.6",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
@ -6310,9 +6310,9 @@
}
},
"node_modules/eslint-plugin-vue": {
"version": "9.12.0",
"resolved": "https://registry.npmmirror.com/eslint-plugin-vue/-/eslint-plugin-vue-9.12.0.tgz",
"integrity": "sha512-xH8PgpDW2WwmFSmRfs/3iWogef1CJzQqX264I65zz77jDuxF2yLy7+GA2diUM8ZNATuSl1+UehMQkb5YEyau5w==",
"version": "9.13.0",
"resolved": "https://registry.npmmirror.com/eslint-plugin-vue/-/eslint-plugin-vue-9.13.0.tgz",
"integrity": "sha512-aBz9A8WB4wmpnVv0pYUt86cmH9EkcwWzgEwecBxMoRNhQjTL5i4sqadnwShv/hOdr8Hbl8XANGV7dtX9UQIAyA==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.3.0",
@ -6320,7 +6320,7 @@
"nth-check": "^2.0.1",
"postcss-selector-parser": "^6.0.9",
"semver": "^7.3.5",
"vue-eslint-parser": "^9.0.1",
"vue-eslint-parser": "^9.3.0",
"xml-name-validator": "^4.0.0"
},
"engines": {

View File

@ -11,8 +11,8 @@
"dependencies": {
"@babel/eslint-parser": "^7.21.8",
"@element-plus/icons-vue": "^2.1.0",
"@typescript-eslint/eslint-plugin": "^5.59.5",
"@typescript-eslint/parser": "^5.59.5",
"@typescript-eslint/eslint-plugin": "^5.59.6",
"@typescript-eslint/parser": "^5.59.6",
"axios": "^1.4.0",
"babel": "^6.23.0",
"echarts": "^5.4.2",
@ -29,7 +29,7 @@
"eslint": "^8.40.0",
"eslint-config-recommended": "^4.1.0",
"eslint-config-standard-with-typescript": "^34.0.1",
"eslint-plugin-vue": "^9.12.0",
"eslint-plugin-vue": "^9.13.0",
"sass": "^1.62.1",
"typescript": "^5.0.4",
"vue-eslint-parser": "^9.3.0"

View File

@ -16,7 +16,7 @@
>
<div class="title-wrapper">
<span>"消7灭6"突围战</span>
<span>月入营坐席</span>
<span>{{ props.month }}月入营坐席</span>
</div>
</div>
</div>
@ -37,9 +37,9 @@ export default {
default: () => [],
},
},
setup()
setup( props )
{
return {};
return { props, };
},
};
</script>

View File

@ -41,12 +41,12 @@
</div>
<div class="reward-wrapper">
<HonorListComponent
month="二"
:month="ui.currentMonth"
:leading-reward="ui.leading_reward_gainers"
:advance-reward="ui.advance_reward_gainers"
/>
<DishonorListComponent
month="二"
:month="ui.currentMonth"
:dishonor-persons="ui.dishonorPersons"
/>
</div>
@ -79,9 +79,12 @@ export default {
},
setup()
{
const monthIndex = new Date();
const numInChinese = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二",];
const router = useRouter();
const callerInfo: TelSaler = getCallerInfo();
const ui = reactive({
currentMonth: numInChinese[monthIndex.getMonth() - 1],
chartData: [0,], //
totalArchievement: 0, //
attaching_rate: "", //

View File

@ -78,9 +78,12 @@ public class DepartmentArchievement
statement.execute();
String attach_rate = statement.getString(2);
String attach_rate = statement.getString( 2 );
String renewal_rate = statement.getString( 3 );
archievement.setAttachingRate( attach_rate );
archievement.setInsuranceRenewalRate( renewal_rate );
return archievement;
}

View File

@ -4,6 +4,9 @@
* @LastEditors: Kane
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/archievement/ArchievementQueryController.java
* @Description:
* 业绩查询控制器
* 1queryDepartmentArchievement响应部门业绩查询
* 2
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
@ -16,11 +19,17 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RequestBody;
import java.sql.SQLException;
import com.cpic.xim.utils.archievement.DepartmentArchievement;
@Controller
@RequestMapping( "/archievement" )
public class ArchievementQueryController
{
/**
* 查询坐席业绩
*/
@PostMapping( "/query_caller_archievement.do" )
public void queryCallerArchievement()
{
@ -38,8 +47,42 @@ public class ArchievementQueryController
@RequestBody DepartmentArchievementQueryRequest request )
{
DepartmentArchievementQueryResult result = new DepartmentArchievementQueryResult();
DepartmentArchievement departmentArch = null;
genTestDepartmentData( result );
try
{
// 查询业绩
departmentArch = DepartmentArchievement
.queryDepartmentArchievement( request.getDepartmentCode() );
Vector<Integer> mensual_archievement = new Vector<Integer>();
mensual_archievement.add( 200 );
mensual_archievement.add( 213 );
mensual_archievement.add( 333 );
mensual_archievement.add( 444 );
mensual_archievement.add( 555 );
mensual_archievement.add( 666 );
result.setSuccess( true );
result.setMessage( "成功" );
result.setTotalArchievement( 1234567890 );
result.setInsuranceRenewalRate( departmentArch.getInsuranceRenewalRate() );
result.setAttachingRate( departmentArch.getAttachingRate() );
result.addAdvanceRewardGainer( "沈群" );
result.addLeadingRewardGainer( "王鸿津" );
result.addLeadingRewardGainer( "林宗泽" );
result.addBackwardStaff( "王炜" );
result.setMensualArchievementList( mensual_archievement );
}
catch ( SQLException error )
{
}
catch ( ClassNotFoundException error )
{
}
return result;
}
@ -64,7 +107,6 @@ public class ArchievementQueryController
data.addLeadingRewardGainer( "王鸿津" );
data.addLeadingRewardGainer( "林宗泽" );
data.addBackwardStaff( "王炜" );
data.setMensualArchievementList( null );
data.setMensualArchievementList( mensual_archievement );
}
}

View File

@ -17,6 +17,7 @@ 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
{
@ -26,8 +27,19 @@ public class CrosFilter implements Filter
{
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) resp;
String originHeader = request.getHeader( "Origin" );
String method = request.getMethod();
String originHeader = null;
// 如果是Options请求就直接返回200状态码
if ( method.equals( HttpMethod.OPTIONS.toString() ) )
{
originHeader = "*";
}
else
{
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" );