-
30new_year_vote_VUE/.gitignore
-
3new_year_vote_VUE/.vscode/extensions.json
-
29new_year_vote_VUE/README.md
-
13new_year_vote_VUE/index.html
-
8new_year_vote_VUE/jsconfig.json
-
3111new_year_vote_VUE/package-lock.json
-
23new_year_vote_VUE/package.json
-
BINnew_year_vote_VUE/public/favicon.ico
-
13new_year_vote_VUE/src/App.vue
-
52new_year_vote_VUE/src/api/CanApi.js
-
14new_year_vote_VUE/src/api/index.js
-
0new_year_vote_VUE/src/assets/base.css
-
1new_year_vote_VUE/src/assets/logo.svg
-
39new_year_vote_VUE/src/assets/main.css
-
BINnew_year_vote_VUE/src/assets/投票/专区.png
-
BINnew_year_vote_VUE/src/assets/投票/产品名称文字底20度.png
-
BINnew_year_vote_VUE/src/assets/投票/产品图.jpg
-
BINnew_year_vote_VUE/src/assets/投票/产品背景.png
-
BINnew_year_vote_VUE/src/assets/投票/底.png
-
BINnew_year_vote_VUE/src/assets/投票/投票 - 货架礼物.jpg
-
BINnew_year_vote_VUE/src/assets/投票/投票按钮.png
-
BINnew_year_vote_VUE/src/assets/投票/货架背景.png
-
BINnew_year_vote_VUE/src/assets/投票/顶.png
-
17new_year_vote_VUE/src/main.js
-
22new_year_vote_VUE/src/router/index.js
-
12new_year_vote_VUE/src/stores/counter.js
-
434new_year_vote_VUE/src/views/BackView.vue
-
183new_year_vote_VUE/src/views/FrontView.vue
-
30new_year_vote_VUE/vite.config.js
-
85vote_new_year.sql
-
33vote_new_year_JAVA/.gitignore
-
410vote_new_year_JAVA/hs_err_pid25076.log
-
131vote_new_year_JAVA/pom.xml
-
12vote_new_year_JAVA/src/main/java/com/lh/VoteSystemApplication.java
-
33vote_new_year_JAVA/src/main/java/com/lh/bean/Candidate.java
-
82vote_new_year_JAVA/src/main/java/com/lh/bean/RespBean.java
-
24vote_new_year_JAVA/src/main/java/com/lh/bean/Voter.java
-
13vote_new_year_JAVA/src/main/java/com/lh/bean/dto/TokenDTO.java
-
35vote_new_year_JAVA/src/main/java/com/lh/config/CORSFilter.java
-
89vote_new_year_JAVA/src/main/java/com/lh/config/CandidateCacheRepository.java
-
22vote_new_year_JAVA/src/main/java/com/lh/config/ExceptionHandler.java
-
37vote_new_year_JAVA/src/main/java/com/lh/config/RedisConfig.java
-
67vote_new_year_JAVA/src/main/java/com/lh/controller/CandidateController.java
-
45vote_new_year_JAVA/src/main/java/com/lh/controller/VoteController.java
-
7vote_new_year_JAVA/src/main/java/com/lh/exception/MyException.java
-
28vote_new_year_JAVA/src/main/java/com/lh/mapper/CandidatesMapper.java
-
21vote_new_year_JAVA/src/main/java/com/lh/mapper/VoterMapper.java
-
24vote_new_year_JAVA/src/main/java/com/lh/service/CandidatesService.java
-
117vote_new_year_JAVA/src/main/java/com/lh/service/CandidatesServiceImpl.java
-
16vote_new_year_JAVA/src/main/java/com/lh/service/VoteService.java
-
191vote_new_year_JAVA/src/main/java/com/lh/service/VoteServiceImpl.java
-
84vote_new_year_JAVA/src/main/java/com/lh/until/Utils.java
-
41vote_new_year_JAVA/src/main/resources/application.properties
-
51vote_new_year_JAVA/src/main/resources/com/lh/mapper/CandidatesMapper.xml
-
20vote_new_year_JAVA/src/main/resources/com/lh/mapper/VoterMapper.xml
-
6vote_new_year_JAVA/src/main/resources/static/index.html
-
69vote_new_year_JAVA/src/test/java/com/lh/VoteSystemApplicationTests.java
-
BIN投票基本设计(目前前台未完成).xlsx
@ -0,0 +1,30 @@ |
|||
# Logs |
|||
logs |
|||
*.log |
|||
npm-debug.log* |
|||
yarn-debug.log* |
|||
yarn-error.log* |
|||
pnpm-debug.log* |
|||
lerna-debug.log* |
|||
|
|||
node_modules |
|||
.DS_Store |
|||
dist |
|||
dist-ssr |
|||
coverage |
|||
*.local |
|||
|
|||
/cypress/videos/ |
|||
/cypress/screenshots/ |
|||
|
|||
# Editor directories and files |
|||
.vscode/* |
|||
!.vscode/extensions.json |
|||
.idea |
|||
*.suo |
|||
*.ntvs* |
|||
*.njsproj |
|||
*.sln |
|||
*.sw? |
|||
|
|||
*.tsbuildinfo |
@ -0,0 +1,3 @@ |
|||
{ |
|||
"recommendations": ["Vue.volar"] |
|||
} |
@ -0,0 +1,29 @@ |
|||
# voting_Vue |
|||
|
|||
This template should help get you started developing with Vue 3 in Vite. |
|||
|
|||
## Recommended IDE Setup |
|||
|
|||
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). |
|||
|
|||
## Customize configuration |
|||
|
|||
See [Vite Configuration Reference](https://vite.dev/config/). |
|||
|
|||
## Project Setup |
|||
|
|||
```sh |
|||
npm install |
|||
``` |
|||
|
|||
### Compile and Hot-Reload for Development |
|||
|
|||
```sh |
|||
npm run dev |
|||
``` |
|||
|
|||
### Compile and Minify for Production |
|||
|
|||
```sh |
|||
npm run build |
|||
``` |
@ -0,0 +1,13 @@ |
|||
<!DOCTYPE html> |
|||
<html lang=""> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<link rel="icon" href="/favicon.ico"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|||
<title>Vite App</title> |
|||
</head> |
|||
<body> |
|||
<div id="app"></div> |
|||
<script type="module" src="/src/main.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,8 @@ |
|||
{ |
|||
"compilerOptions": { |
|||
"paths": { |
|||
"@/*": ["./src/*"] |
|||
} |
|||
}, |
|||
"exclude": ["node_modules", "dist"] |
|||
} |
3111
new_year_vote_VUE/package-lock.json
File diff suppressed because it is too large
View File
@ -0,0 +1,23 @@ |
|||
{ |
|||
"name": "voting-vue", |
|||
"version": "0.0.0", |
|||
"private": true, |
|||
"type": "module", |
|||
"scripts": { |
|||
"dev": "vite --host 0.0.0.0", |
|||
"build": "vite build", |
|||
"preview": "vite preview" |
|||
}, |
|||
"dependencies": { |
|||
"axios": "^1.7.9", |
|||
"element-plus": "^2.9.1", |
|||
"pinia": "^2.2.6", |
|||
"vue": "^3.5.13", |
|||
"vue-router": "^4.4.5" |
|||
}, |
|||
"devDependencies": { |
|||
"@vitejs/plugin-vue": "^5.2.1", |
|||
"vite": "^6.0.1", |
|||
"vite-plugin-vue-devtools": "^7.6.5" |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
<script setup> |
|||
import { RouterLink, RouterView } from 'vue-router' |
|||
</script> |
|||
|
|||
<template> |
|||
|
|||
|
|||
<RouterView /> |
|||
</template> |
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
@ -0,0 +1,52 @@ |
|||
import service from "." |
|||
|
|||
const CanApi = { |
|||
//前台获取候选人列表
|
|||
getCandidates(token) { |
|||
// return service.post('https://api.homilychart.com/investvote/getCandidates',{token});
|
|||
return service.post('/getCandidates', { token }); |
|||
}, |
|||
|
|||
//投票
|
|||
Vote(token, code) { |
|||
let formData = new FormData(); |
|||
formData.append("token", token); |
|||
formData.append("code", code); |
|||
// return service.post('https://api.homilychart.com/investvote/vote',formData)
|
|||
return service.post('/vote', formData) |
|||
}, |
|||
//分页搜索
|
|||
selectByPage(pageNum, name, location) { |
|||
return service.get('/getCandidatesPage', { params: { pageNum, name, location } }) |
|||
}, |
|||
//新增
|
|||
addCandidate(candidate) { |
|||
return service.post('/addCandidate', candidate) |
|||
}, |
|||
//通过精网号查询
|
|||
getCandidateByjwcode(jwcode) { |
|||
return service.get(`/getCandidateByJwcode/${jwcode}`) |
|||
}, |
|||
//修改
|
|||
updateCandidate(candidate) { |
|||
return service.post('/updateCandidate', candidate) |
|||
}, |
|||
//下架
|
|||
// changeCandidateByJwcode(jwcode){
|
|||
// return service.get(`/changeCandidateByJwcode/${jwcode}`)
|
|||
// },
|
|||
//查看详情
|
|||
getDetail(jwcode) { |
|||
return service.get(`/getVotesByCandidate/${jwcode}`) |
|||
}, |
|||
//在详情中的根据精网号查询
|
|||
getVoterByCandidateAndVoterJwcode(candidateJwcode,voterJwcode) { |
|||
return service.get('/getVoterByCandidateAndVoterJwcode', { params: { candidateJwcode,voterJwcode } }) |
|||
}, |
|||
//真实人数
|
|||
getRealCount(candidateJwcode){ |
|||
return service.get(`/getRealCount/${candidateJwcode}`) |
|||
} |
|||
} |
|||
|
|||
export default CanApi; |
@ -0,0 +1,14 @@ |
|||
import axios from "axios"; |
|||
|
|||
const service = axios.create({ |
|||
baseURL: '/api', |
|||
}); |
|||
|
|||
|
|||
//Axios的响应拦截器..
|
|||
service.interceptors.response.use(resp => { |
|||
return resp.data; |
|||
}, error => { |
|||
return Promise.reject(error); |
|||
}); |
|||
export default service; |
@ -0,0 +1 @@ |
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg> |
@ -0,0 +1,39 @@ |
|||
*{ |
|||
margin: 0; |
|||
padding: 0; |
|||
} |
|||
html{ |
|||
font-size: 1vw; |
|||
} |
|||
div{ |
|||
font-size: 1rem; |
|||
} |
|||
/* html,body{ |
|||
height: 100%; |
|||
} |
|||
#app{ |
|||
height: 100%; |
|||
} */ |
|||
/* 手机 */ |
|||
@media (max-width:750px){ |
|||
html{ |
|||
font-size: 10.5px; |
|||
} |
|||
div{ |
|||
font-size: 1rem; |
|||
} |
|||
} |
|||
/* 平板 */ |
|||
@media (min-width: 750px) and (max-width:1279px){ |
|||
html{ |
|||
font-size: 2.5vw; |
|||
} |
|||
div{ |
|||
font-size: 1rem; |
|||
} |
|||
} |
|||
/* 电脑 */ |
|||
@media (min-width:1280px){ |
|||
|
|||
} |
|||
|
After Width: 581 | Height: 126 | Size: 26 KiB |
After Width: 133 | Height: 88 | Size: 8.1 KiB |
After Width: 128 | Height: 80 | Size: 1.1 KiB |
After Width: 200 | Height: 154 | Size: 13 KiB |
After Width: 726 | Height: 318 | Size: 49 KiB |
After Width: 750 | Height: 942 | Size: 257 KiB |
After Width: 162 | Height: 47 | Size: 5.1 KiB |
After Width: 633 | Height: 565 | Size: 3.5 KiB |
After Width: 727 | Height: 142 | Size: 51 KiB |
@ -0,0 +1,17 @@ |
|||
import './assets/main.css' |
|||
|
|||
import { createApp } from 'vue' |
|||
import { createPinia } from 'pinia' |
|||
|
|||
import App from './App.vue' |
|||
import router from './router' |
|||
import ElementPlus from 'element-plus' |
|||
import 'element-plus/dist/index.css' |
|||
|
|||
const app = createApp(App) |
|||
|
|||
app.use(createPinia()) |
|||
app.use(router) |
|||
|
|||
app.use(ElementPlus) |
|||
app.mount('#app') |
@ -0,0 +1,22 @@ |
|||
import { createRouter, createWebHistory } from 'vue-router' |
|||
import FrontView from '../views/FrontView.vue' |
|||
import BackView from '@/views/BackView.vue' |
|||
|
|||
|
|||
const router = createRouter({ |
|||
history: createWebHistory(import.meta.env.BASE_URL), |
|||
routes: [ |
|||
{ |
|||
path: '/', |
|||
name: 'front', |
|||
component: FrontView, |
|||
}, |
|||
{ |
|||
path: '/back', |
|||
name: 'back', |
|||
component: BackView |
|||
}, |
|||
], |
|||
}) |
|||
|
|||
export default router |
@ -0,0 +1,12 @@ |
|||
import { ref, computed } from 'vue' |
|||
import { defineStore } from 'pinia' |
|||
|
|||
export const useCounterStore = defineStore('counter', () => { |
|||
const count = ref(0) |
|||
const doubleCount = computed(() => count.value * 2) |
|||
function increment() { |
|||
count.value++ |
|||
} |
|||
|
|||
return { count, doubleCount, increment } |
|||
}) |
@ -0,0 +1,434 @@ |
|||
<template> |
|||
<!-- start表单主体部分 --> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<el-card style="max-width: 100%"> |
|||
<div class="mb-4"> |
|||
<el-button type="primary" style="margin: 8px; float: left;" @click="AddShowFlag = true">增加</el-button> |
|||
</div> |
|||
<el-input v-model="name" style="width: 240px; float: right; margin: 8px;" placeholder="输入名称搜索" |
|||
:prefix-icon="Search" @input="selectByPage(1, name, location)" /> |
|||
<el-input v-model="location" style="width: 240px; float: right; margin: 8px;" placeholder="输入货架搜索" |
|||
:prefix-icon="Search" @input="selectByPage(1, name, location)" /> |
|||
<el-table :data="pageList.list" style="width: 100%" border> |
|||
<el-table-column type="index" :index="indexMethod" label="序号" /> |
|||
<el-table-column prop="name" label="名称" /> |
|||
<el-table-column prop="jwcode" label="编号" /> |
|||
<el-table-column prop="avatar" label="图片" width="80"> |
|||
<template #default="scope"> |
|||
<el-avatar shape="square" :size="50" :src="scope.row.avatar" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="votes" label="票数" /> |
|||
<el-table-column prop="status" label="状态"> |
|||
<template #default="scope"> |
|||
<el-tag v-if="scope.row.status == '1'" type="success">已上架</el-tag> |
|||
<el-tag v-else type="danger">已下架</el-tag> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="location" label="位置" /> |
|||
<el-table-column prop="money" label="价值" /> |
|||
<el-table-column label="操作"> |
|||
<template #default="scope"> |
|||
<el-button size="small" @click="selectByJwcode(scope.row.jwcode)"> |
|||
编辑 |
|||
</el-button> |
|||
<el-button size="small" @click="getDetail(scope.row.jwcode)"> |
|||
查看详情 |
|||
</el-button> |
|||
<!-- 删除的气泡框 --> |
|||
<!-- <el-popconfirm confirm-button-text="确定" cancel-button-text="取消" :icon="InfoFilled" icon-color="#626AEF" |
|||
title="确定要删除吗?" @confirm="" @cancel="cancelEvent"> |
|||
<template #reference> |
|||
<el-button size="small" type="danger"> |
|||
删除 |
|||
</el-button> |
|||
</template> |
|||
</el-popconfirm> --> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<!-- 分页 --> |
|||
<el-row class="row-bg" justify="center"> |
|||
<el-pagination background layout="prev, pager, next" :page-count="pageList.pages" style="margin: 10px;" |
|||
page-size=10 small="true" v-model:current-page="pageList.pageNum" @update:current-page="selectByPage" /> |
|||
</el-row> |
|||
</el-card> |
|||
</el-col> |
|||
</el-row> |
|||
<!-- end表单主体部分 --> |
|||
|
|||
<!-- start增加提示框 --> |
|||
<div> |
|||
<el-dialog v-model="AddShowFlag" title="添加候选人/物品" width="500"> |
|||
<el-form :rules="rules" ref="ruleFormRef" :model="candidateAdd"> |
|||
<el-form-item label="名称" label-width="20%" prop="name"> |
|||
<el-input autocomplete="off" v-model="candidateAdd.name" /> |
|||
</el-form-item> |
|||
<el-form-item label="编号" label-width="20%" prop="jwcode"> |
|||
<el-input autocomplete="off" v-model="candidateAdd.jwcode" /> |
|||
</el-form-item> |
|||
<el-form-item label="图片" label-width="20%" prop="avatar"> |
|||
<el-upload class="avatar-uploader" action="http://39.101.133.168:8828/hljw/api/aws/upload" :show-file-list="false" :on-success="successChange" |
|||
:before-upload="beforeAvatarUpload" :on-change="handleChange"> |
|||
<img v-if="candidateAdd.avatar" :src="candidateAdd.avatar" class="avatar" /> |
|||
<el-icon v-else class="avatar-uploader-icon"> |
|||
<Plus /> |
|||
</el-icon> |
|||
</el-upload> |
|||
</el-form-item> |
|||
<el-form-item label="状态" label-width="20%" prop="status"> |
|||
<el-radio-group v-model="candidateAdd.status" style="margin-left: 8px;"> |
|||
<el-radio value="1">已上架</el-radio> |
|||
<el-radio value="0">未上架</el-radio> |
|||
</el-radio-group> |
|||
</el-form-item> |
|||
<el-form-item label="位置" label-width="20%" prop="location"> |
|||
<el-input autocomplete="off" v-model="candidateAdd.location" /> |
|||
</el-form-item> |
|||
<el-form-item label="价值" label-width="20%" prop="money"> |
|||
<el-input autocomplete="off" v-model="candidateAdd.money" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template #footer> |
|||
<div class="dialog-footer"> |
|||
<el-button @click="AddShowFlag = false">取消</el-button> |
|||
<el-button type="primary" @click="addCandidate"> |
|||
保存 |
|||
</el-button> |
|||
</div> |
|||
</template> |
|||
</el-dialog> |
|||
</div> |
|||
<!-- end增加提示框 --> |
|||
|
|||
<!-- start编辑提示框 --> |
|||
<div> |
|||
<el-dialog v-model="UpdateShowFlag" title="修改候选人/物品" width="500"> |
|||
<el-form :rules="rules" ref="ruleFormRef" :model="candidateUpdate"> |
|||
<el-form-item label="名称" label-width="20%" prop="name"> |
|||
<el-input autocomplete="off" v-model="candidateUpdate.name" /> |
|||
</el-form-item> |
|||
<el-form-item label="编号" label-width="20%" prop="jwcode"> |
|||
<el-input autocomplete="off" v-model="candidateUpdate.jwcode" /> |
|||
</el-form-item> |
|||
<el-form-item label="图片地址" label-width="20%" prop="avatar"> |
|||
<el-upload class="avatar-uploader" action="http://39.101.133.168:8828/hljw/api/aws/upload" :show-file-list="false" :on-success="successChange1" |
|||
:before-upload="beforeAvatarUpload" :on-change="handleChange"> |
|||
<img v-if="candidateUpdate.avatar" :src="candidateUpdate.avatar" class="avatar" /> |
|||
<el-icon v-else class="avatar-uploader-icon"> |
|||
<Plus /> |
|||
</el-icon> |
|||
</el-upload> |
|||
</el-form-item> |
|||
<el-form-item label="状态" label-width="20%" prop="status"> |
|||
<el-radio-group v-model="candidateUpdate.status" style="margin-left: 8px;"> |
|||
<el-radio :value="1">已上架</el-radio> |
|||
<el-radio :value="0">未上架</el-radio> |
|||
</el-radio-group> |
|||
</el-form-item> |
|||
<el-form-item label="位置" label-width="20%" prop="location"> |
|||
<el-input autocomplete="off" v-model="candidateUpdate.location" /> |
|||
</el-form-item> |
|||
<el-form-item label="价值" label-width="20%" prop="money"> |
|||
<el-input autocomplete="off" v-model="candidateUpdate.money" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template #footer> |
|||
<div class="dialog-footer"> |
|||
<el-button @click="UpdateShowFlag = false">取消</el-button> |
|||
<el-button type="primary" @click="updateCandidate"> |
|||
保存 |
|||
</el-button> |
|||
</div> |
|||
</template> |
|||
</el-dialog> |
|||
</div> |
|||
<!-- end编辑提示框 --> |
|||
|
|||
<!-- start详情提示框 --> |
|||
<div> |
|||
<el-dialog v-model="DetailShowFlag" title="投票详情" width="800"> |
|||
<span>实际票数:{{ realCount }}</span> |
|||
<el-input v-model="voterJwcodeSearch" style="width: 240px; float: right; margin: 8px;" placeholder="输入名称搜索" |
|||
:prefix-icon="Search" @input="getVoterByCandidateAndVoterJwcode" /> |
|||
<el-table :data="detailList" style="width: 100%" border> |
|||
<el-table-column type="index" :index="indexMethod" label="序号" /> |
|||
<el-table-column prop="name" label="用户名" /> |
|||
<el-table-column prop="jwCode" label="精网号" /> |
|||
<el-table-column prop="voteTime" label="时间" /> |
|||
</el-table> |
|||
</el-dialog> |
|||
</div> |
|||
<!-- end详情提示框 --> |
|||
</template> |
|||
|
|||
<script setup> |
|||
import { ref } from 'vue'; |
|||
import { ElMessage, ElLoading, imageProps } from 'element-plus'; |
|||
import { InfoFilled } from '@element-plus/icons-vue' |
|||
import { Search } from '@element-plus/icons-vue' |
|||
import CanApi from '@/api/CanApi'; |
|||
|
|||
//分页数据 |
|||
const pageList = ref([]); |
|||
//条件查询参数 |
|||
const name = ref(''); |
|||
const location = ref(''); |
|||
function selectByPage(pageNum) { |
|||
//location输入校验,location必须为数字 |
|||
if (location.value != '' && !/^[0-9]*$/.test(location.value)) { |
|||
ElMessage.error('请输入正确的货架号'); |
|||
return; |
|||
} |
|||
CanApi.selectByPage(pageNum, name.value, location.value).then(resp => { |
|||
if (resp.code == 10000) { |
|||
pageList.value = resp.data; |
|||
} else { |
|||
ElMessage({ |
|||
message: resp.msg, |
|||
type: 'error', |
|||
duration: 1000 |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
selectByPage(1); |
|||
|
|||
//新增提示框 |
|||
const AddShowFlag = ref(false); |
|||
//新增对象 |
|||
const candidateAdd = ref({ |
|||
jwcode: '', |
|||
name: '', |
|||
avatar: '', |
|||
votes: 0, |
|||
location: '', |
|||
status: 0, |
|||
money: '' |
|||
}); |
|||
//新增方法 |
|||
function addCandidate() { |
|||
ruleFormRef.value.validate((valid) => { |
|||
if (valid) { |
|||
CanApi.addCandidate(candidateAdd.value).then(resp => { |
|||
if (resp.code == 10000) { |
|||
ElMessage({ |
|||
message: resp.msg, |
|||
type: 'success', |
|||
duration: 1000 |
|||
}); |
|||
//重置 |
|||
candidateAdd.value = { |
|||
jwcode: '', |
|||
name: '', |
|||
avatar: '', |
|||
votes: 0, |
|||
location: '', |
|||
status: 0, |
|||
money: '' |
|||
}; |
|||
AddShowFlag.value = false; |
|||
selectByPage(1); |
|||
} else { |
|||
ElMessage({ |
|||
message: resp.msg, |
|||
type: 'error', |
|||
duration: 1000 |
|||
}); |
|||
} |
|||
}); |
|||
} else { |
|||
ElMessage({ |
|||
message: '请输入完整信息', |
|||
type: 'error', |
|||
duration: 1000 |
|||
}); |
|||
} |
|||
}) |
|||
} |
|||
|
|||
//编辑提示框 |
|||
const UpdateShowFlag = ref(false); |
|||
//编辑对象 |
|||
const candidateUpdate = ref({ |
|||
jwcode: '', |
|||
name: '', |
|||
avatar: '', |
|||
votes: 0, |
|||
location: '', |
|||
status: 0, |
|||
money: '' |
|||
}); |
|||
//根据jwcode查询 |
|||
function selectByJwcode(jwcode) { |
|||
UpdateShowFlag.value = true; |
|||
CanApi.getCandidateByjwcode(jwcode).then(resp => { |
|||
if (resp.code == 10000) { |
|||
candidateUpdate.value = resp.data; |
|||
} else { |
|||
ElMessage({ |
|||
message: resp.msg, |
|||
type: 'error', |
|||
duration: 1000 |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
function updateCandidate() { |
|||
ruleFormRef.value.validate((valid) => { |
|||
if (valid) { |
|||
CanApi.updateCandidate(candidateUpdate.value).then(resp => { |
|||
if (resp.code == 10000) { |
|||
ElMessage({ |
|||
message: resp.msg, |
|||
type: 'success', |
|||
duration: 1000 |
|||
}); |
|||
//关闭弹窗 |
|||
UpdateShowFlag.value = false; |
|||
selectByPage(1); |
|||
} else { |
|||
ElMessage({ |
|||
message: resp.msg, |
|||
type: 'error', |
|||
duration: 1000 |
|||
}); |
|||
} |
|||
}); |
|||
} else { |
|||
ElMessage({ |
|||
message: '请输入完整信息', |
|||
type: 'error', |
|||
duration: 1000 |
|||
}); |
|||
} |
|||
}) |
|||
} |
|||
|
|||
//转换状态 |
|||
// function changeCandidateByJwcode(jwcode) { |
|||
// CanApi.changeCandidateByJwcode().then(resp => { |
|||
// if (resp.code == 10000) { |
|||
// ElMessage({ |
|||
// message: resp.msg, |
|||
// type: 'success', |
|||
// duration: 1000 |
|||
// }); |
|||
// selectByPage(1); |
|||
// } else { |
|||
// ElMessage({ |
|||
// message: resp.msg, |
|||
// type: 'error', |
|||
// duration: 1000 |
|||
// }); |
|||
// } |
|||
// }); |
|||
// } |
|||
|
|||
|
|||
//详情 |
|||
const DetailShowFlag = ref(false); |
|||
//详情列表 |
|||
const detailList = ref([]); |
|||
//详情搜索条件(voteJwcode) |
|||
const voterJwcodeSearch = ref(''); |
|||
const candidateJwcodeSearch = ref(''); |
|||
//真实票数 |
|||
const realCount = ref(0); |
|||
//查看详情 |
|||
function getDetail(jwcode) { |
|||
DetailShowFlag.value = true; |
|||
CanApi.getDetail(jwcode).then(resp => { |
|||
if (resp.code == 10000) { |
|||
detailList.value = resp.data; |
|||
candidateJwcodeSearch.value = jwcode; |
|||
} else { |
|||
ElMessage({ |
|||
message: resp.msg, |
|||
type: 'error', |
|||
}) |
|||
} |
|||
}) |
|||
CanApi.getRealCount(jwcode).then(resp => { |
|||
realCount.value = resp.data; |
|||
}) |
|||
} |
|||
//详情中的根据精网号查询 |
|||
function getVoterByCandidateAndVoterJwcode() { |
|||
CanApi.getVoterByCandidateAndVoterJwcode(voterJwcodeSearch.value, candidateJwcodeSearch.value).then(resp => { |
|||
if (resp.code == 10000) { |
|||
detailList.value = resp.data; |
|||
} else { |
|||
ElMessage({ |
|||
message: resp.msg, |
|||
type: 'error', |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
|
|||
//图片上传 |
|||
function successChange(file, fileList) { |
|||
if (fileList.response.code == 200) { |
|||
candidateAdd.value.avatar = fileList.response.data.url; |
|||
// console.log('这是fileList', this.url) |
|||
} |
|||
} |
|||
|
|||
//图片上传(编辑) |
|||
function successChange1(file, fileList) { |
|||
if (fileList.response.code == 200) { |
|||
candidateUpdate.value.avatar = fileList.response.data.url; |
|||
// console.log('这是fileList', this.url) |
|||
} |
|||
} |
|||
function handleChange(file, fileList) { |
|||
// 当多余一个的时候替换文件 |
|||
if (fileList.length > 1) { |
|||
fileList.splice(0, 1) |
|||
} |
|||
|
|||
} |
|||
//表单校验 |
|||
const rules = { |
|||
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }], |
|||
avatar: [{ required: true, message: '请输入照片地址', trigger: 'blur' }], |
|||
status: [{ required: true, message: '请输入状态', trigger: 'blur' }], |
|||
location: [{ required: true, message: '请输入位置', trigger: 'blur' }], |
|||
money: [{ required: true, message: '请输入价值', trigger: 'blur' }], |
|||
jwcode: [{ required: true, message: '请输入编号', trigger: 'blur' }] |
|||
} |
|||
const ruleFormRef = ref(null); |
|||
|
|||
//序号 |
|||
const indexMethod = function (index) { |
|||
return index + 1; |
|||
} |
|||
</script> |
|||
|
|||
|
|||
<style scoped> |
|||
/* 用户头像 */ |
|||
.avatar-uploader, |
|||
.avatar { |
|||
width: 178px; |
|||
height: 178px; |
|||
display: block; |
|||
border: 1px dotted #dcdfe6; |
|||
border-radius: 5px; |
|||
} |
|||
|
|||
.el-icon.avatar-uploader-icon { |
|||
font-size: 28px; |
|||
color: #031022; |
|||
width: 178px; |
|||
height: 178px; |
|||
text-align: center; |
|||
} |
|||
|
|||
/* 解决 上传下载按钮 不能再一行显示 */ |
|||
.inline-block { |
|||
display: inline-block; |
|||
} |
|||
</style> |
@ -0,0 +1,183 @@ |
|||
<template> |
|||
<div class="all-container"> |
|||
<div class="shelves"> |
|||
<div class="shelves-title"> |
|||
<img src="/src/assets/投票/专区.png" alt=""> |
|||
</div> |
|||
<div class="shelves-top"> |
|||
<img src="/src/assets/投票/顶.png" alt=""> |
|||
</div> |
|||
<div class="gift-container"> |
|||
<div class="gift-item" v-for="(item, index) in gifts" :key="index"> |
|||
<img class="gift-background" src="/src/assets/投票/产品背景.png"> |
|||
<img class="gift-img" src="/src/assets/投票/产品图.jpg" alt=""> |
|||
</div> |
|||
<div class="shelves-bottom"> |
|||
<img src="/src/assets/投票/底.png" alt=""> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup> |
|||
import CanApi from '@/api/CanApi'; |
|||
import { defaultInitialZIndex, ElMessage } from 'element-plus'; |
|||
import { ref } from 'vue'; |
|||
|
|||
//获取当前浏览器地址 |
|||
// var url = window.location.href;//服务器 |
|||
var url = "https://wwww.voted?token=+Xor5AADhxfIb4C2phTnbZi0+fEeMx8pywnIlrmTl49EP6klwzmEVu0/qp0vKns/KdxYPvSjzdZ4Q6n17sg" |
|||
//截取token=后的字符串 |
|||
|
|||
var token = null; |
|||
function getToken() { |
|||
var parts = url.split("token="); |
|||
if (parts.length > 1) { |
|||
token = parts[1].split("&")[0]; // 进一步截取 & 之前的字符串 |
|||
} |
|||
token = decodeURIComponent(token); |
|||
console.log("token字符串:", token); // 输出 token 的值 |
|||
} |
|||
getToken(); |
|||
|
|||
//候选人 |
|||
const candidateList = ref([]) |
|||
|
|||
//加载候选人 |
|||
function getCandidates(token) { |
|||
CanApi.getCandidates(token).then(result => { |
|||
candidateList.value = result.data; |
|||
}) |
|||
} |
|||
getCandidates(token); |
|||
//投票 |
|||
function vote(code) { |
|||
console.log("code:", code) |
|||
// voter.value.voterJwcode,voter.value.candidateJwcode,voter.value.voterName |
|||
CanApi.Vote(token, code).then(result => { |
|||
|
|||
if (result.code == 10000) { |
|||
ElMessage.success(result.msg); |
|||
loadCandidates(token); |
|||
} else { |
|||
ElMessage.error(result.msg) |
|||
loadCandidates(token); |
|||
} |
|||
}) |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
const gifts = ref([ |
|||
{ name: '礼物名称1', votes: 55 }, |
|||
{ name: '礼物名称2', votes: 55 }, |
|||
{ name: '礼物名称3', votes: 55 } |
|||
]); |
|||
|
|||
|
|||
</script> |
|||
|
|||
<style scoped> |
|||
.all-container { |
|||
width: 700px; |
|||
background-color: #ffffff; |
|||
margin-left: auto; |
|||
margin-right: auto; |
|||
} |
|||
|
|||
.shelves { |
|||
width: 100%; |
|||
margin-left: auto; |
|||
margin-right: auto; |
|||
font-family: Arial, sans-serif; |
|||
background-image: url(/src/assets/投票/货架背景.png); |
|||
/* 让背景沾满容器 */ |
|||
background-size: 100% 100%; |
|||
padding: 20px; |
|||
} |
|||
|
|||
.shelves-title { |
|||
margin-top: 20px; |
|||
margin-bottom: -70px; |
|||
text-align: center; |
|||
/* 显示在上层 */ |
|||
position: relative; |
|||
z-index: 3; |
|||
} |
|||
|
|||
.shelves-top { |
|||
text-align: center; |
|||
position: relative; |
|||
z-index: 2; |
|||
} |
|||
|
|||
.shelves-bottom { |
|||
text-align: center; |
|||
|
|||
position: relative; |
|||
z-index: 1; |
|||
} |
|||
|
|||
.shelves-top img, |
|||
.shelves-bottom img { |
|||
width: 100%; |
|||
} |
|||
|
|||
.shelves-bottom img { |
|||
margin-top: -200px; |
|||
} |
|||
|
|||
.gift-container { |
|||
display: flex; |
|||
/* 居中 */ |
|||
justify-content: center; |
|||
flex-wrap: wrap; |
|||
/* 允许子元素换行 */ |
|||
margin-bottom: 20px; |
|||
margin-left: auto; |
|||
margin-right: auto; |
|||
position: relative; |
|||
} |
|||
|
|||
.gift-item { |
|||
border-radius: 5px; |
|||
padding: 10px; |
|||
width: 200px; |
|||
height: auto; |
|||
/* 每个项目大约占一行的 30% */ |
|||
box-sizing: border-box; |
|||
/* 包括内边距和边框在内的宽度计算 */ |
|||
margin-bottom: 0; |
|||
/* 项目之间的间距 */ |
|||
} |
|||
|
|||
.gift-background { |
|||
width: 100%; |
|||
margin-bottom: -22px; |
|||
|
|||
position: relative; |
|||
z-index: 2; |
|||
} |
|||
.gift-img{ |
|||
width: 125px; |
|||
height: 80px; |
|||
position: absolute; |
|||
z-index: 3; |
|||
margin-left: -150px; |
|||
top: 52px; |
|||
border-radius: 5px; |
|||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); |
|||
} |
|||
|
|||
.gift-name { |
|||
font-weight: bold; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
.vote-count { |
|||
color: red; |
|||
font-weight: bold; |
|||
} |
|||
</style> |
@ -0,0 +1,30 @@ |
|||
import { fileURLToPath, URL } from 'node:url' |
|||
|
|||
import { defineConfig } from 'vite' |
|||
import vue from '@vitejs/plugin-vue' |
|||
|
|||
|
|||
// https://vite.dev/config/
|
|||
export default defineConfig({ |
|||
plugins: [ |
|||
vue(), |
|||
// vueDevTools(),
|
|||
], |
|||
resolve: { |
|||
alias: { |
|||
'@': fileURLToPath(new URL('./src', import.meta.url)) |
|||
}, |
|||
}, |
|||
// base: '/investvote/', // 服务器:设置资源的基础路径
|
|||
server: { |
|||
proxy: { |
|||
'/api': { |
|||
//后端服务器地址
|
|||
// target: 'http://mp.homilychart.com', //服务器地址
|
|||
target: 'http://192.168.8.174:8092', //本地调试地址
|
|||
changeOrigin: true, |
|||
rewrite: (path) => path.replace(/^\/api/, '') |
|||
} |
|||
} |
|||
} |
|||
}) |
@ -0,0 +1,85 @@ |
|||
/* |
|||
Navicat Premium Dump SQL |
|||
|
|||
Source Server : lenghui |
|||
Source Server Type : MySQL |
|||
Source Server Version : 80039 (8.0.39) |
|||
Source Host : localhost:3306 |
|||
Source Schema : vote_new_year |
|||
|
|||
Target Server Type : MySQL |
|||
Target Server Version : 80039 (8.0.39) |
|||
File Encoding : 65001 |
|||
|
|||
Date: 18/01/2025 10:47:06 |
|||
*/ |
|||
|
|||
SET NAMES utf8mb4; |
|||
SET FOREIGN_KEY_CHECKS = 0; |
|||
|
|||
-- ---------------------------- |
|||
-- Table structure for candidates |
|||
-- ---------------------------- |
|||
DROP TABLE IF EXISTS `candidates`; |
|||
CREATE TABLE `candidates` ( |
|||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', |
|||
`jwcode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '物品编号', |
|||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '候选人名字', |
|||
`avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '候选人头像', |
|||
`votes` int NULL DEFAULT 0 COMMENT '票数', |
|||
`status` int NULL DEFAULT NULL COMMENT '状态', |
|||
`location` int NULL DEFAULT NULL COMMENT '位置', |
|||
`money` int NULL DEFAULT NULL COMMENT '价值', |
|||
`spare1` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, |
|||
`spare2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, |
|||
`spare3` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, |
|||
PRIMARY KEY (`id`) USING BTREE, |
|||
UNIQUE INDEX `jwcode`(`jwcode` ASC) USING BTREE |
|||
) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC; |
|||
|
|||
-- ---------------------------- |
|||
-- Records of candidates |
|||
-- ---------------------------- |
|||
INSERT INTO `candidates` VALUES (1, '010', '粉底', 'https://cdn.legu168.com/jtzy/Product/pcjingwang/uploads/images/3fe5bfe4d6d22969e4e744fb5ffcc42c.png', 2, 1, 2, 100000, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (2, '009', '口红', 'https://cdn.legu168.com/jtzy/Product/pcjingwang/uploads/images/b9e13ae84c87cafcbcb56420f04f34da.png', 0, 1, 2, 200, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (3, '008', '酒店抵用券', 'https://cdn.legu168.com/jtzy/Product/pcjingwang/uploads/images/d604ded24c51b1be131ff16934fd7744.png', 0, 1, 3, 300, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (4, '007', '德州扒鸡', 'https://cdn.legu168.com/jtzy/Product/pcjingwang/uploads/images/c7aceb66e69097e8f734f12b9e36ab30.png', 3, 1, 4, 400, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (5, '006', '胡辣汤', 'https://cdn.legu168.com/jtzy/Product/pcjingwang/uploads/images/21e50e2f6931024e1079cae45e751840.png', 0, 1, 1, 500, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (6, '005', 'AI探牛7天', 'https://cdn.legu168.com/jtzy/Product/pcjingwang/uploads/images/28a4ca14aaa3cfb6daa5de1ff504f034.png', 0, 1, 2, 600, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (7, '004', '预测大师', 'https://cdn.legu168.com/jtzy/Product/pcjingwang/uploads/images/cb706bb1adc66b999e75029525b21d03.png', 0, 1, 3, 700, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (8, '003', '雷达', 'https://cdn.legu168.com/jtzy/Product/pcjingwang/uploads/images/774bcb3c19fba708ccb61aed1475330c.png', 0, 1, 4, 800, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (9, '002', '铁皮', 'https://cdn.legu168.com/jtzy/Product/pcjingwang/uploads/images/386cc0f515c5a13f44306d7f20d623ab.png', 0, 0, 1, 900, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (10, '001', '其他', 'https://cdn.legu168.com/jtzy/Product/pcjingwang/uploads/images/097cc365b03e723ad5f9bbadd42859f3.png', 0, 1, 2, 1000, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (12, '011', 'iphone18', 'https://d31zlh4on95l9h.cloudfront.net/default/39156502f8f218cf63f751e081406a8e.png', 0, 0, 2, 1000, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (13, 'A001', '高级粉底', '1.jpg', 0, 1, 1, 2000, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (14, 'A002', '高级口红', '2.jpg', 0, 1, 2, 3000, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (15, 'A003', 'TD', '1.jpg', 1, 1, 1, 2000, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (16, 'A201', '康康', '1.jpg', 1, 1, 1, 1000, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (17, 'A301', '冷辉', '1.jpg', 0, 0, 3, 3000, NULL, NULL, NULL); |
|||
INSERT INTO `candidates` VALUES (19, '020', 'iphone100', 'https://d31zlh4on95l9h.cloudfront.net/default/0b6766aaee31e9b740c53e00a172399b.jpg', 0, 1, 5, 99999, NULL, NULL, NULL); |
|||
|
|||
-- ---------------------------- |
|||
-- Table structure for voters |
|||
-- ---------------------------- |
|||
DROP TABLE IF EXISTS `voters`; |
|||
CREATE TABLE `voters` ( |
|||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID', |
|||
`jwcode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '精网号', |
|||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '投票者名字', |
|||
`vote_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '投票时间戳', |
|||
`candidate_jwcode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '候选人精网号', |
|||
PRIMARY KEY (`id`) USING BTREE |
|||
) ENGINE = InnoDB AUTO_INCREMENT = 181 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '投票者表' ROW_FORMAT = DYNAMIC; |
|||
|
|||
-- ---------------------------- |
|||
-- Records of voters |
|||
-- ---------------------------- |
|||
INSERT INTO `voters` VALUES (174, '90044599', '游客 90****99', '2025-01-13 18:29:59', '010'); |
|||
INSERT INTO `voters` VALUES (175, '90044598', '游客 90****99', '2025-01-15 18:30:07', '010'); |
|||
INSERT INTO `voters` VALUES (176, '90044599', '游客 90****99', '2025-01-15 15:02:34', '010'); |
|||
INSERT INTO `voters` VALUES (177, '90044599', '游客 90****99', '2025-01-15 15:02:36', '007'); |
|||
INSERT INTO `voters` VALUES (178, '90044599', '游客 90****99', '2025-01-16 14:38:26', '007'); |
|||
INSERT INTO `voters` VALUES (179, '90044599', '游客 90****99', '2025-01-16 14:38:27', 'A003'); |
|||
INSERT INTO `voters` VALUES (180, '90044599', '游客 90****99', '2025-01-16 14:38:41', 'A201'); |
|||
|
|||
SET FOREIGN_KEY_CHECKS = 1; |
@ -0,0 +1,33 @@ |
|||
HELP.md |
|||
target/ |
|||
!.mvn/wrapper/maven-wrapper.jar |
|||
!**/src/main/**/target/ |
|||
!**/src/test/**/target/ |
|||
|
|||
### STS ### |
|||
.apt_generated |
|||
.classpath |
|||
.factorypath |
|||
.project |
|||
.settings |
|||
.springBeans |
|||
.sts4-cache |
|||
|
|||
### IntelliJ IDEA ### |
|||
.idea |
|||
*.iws |
|||
*.iml |
|||
*.ipr |
|||
|
|||
### NetBeans ### |
|||
/nbproject/private/ |
|||
/nbbuild/ |
|||
/dist/ |
|||
/nbdist/ |
|||
/.nb-gradle/ |
|||
build/ |
|||
!**/src/main/**/build/ |
|||
!**/src/test/**/build/ |
|||
|
|||
### VS Code ### |
|||
.vscode/ |
@ -0,0 +1,410 @@ |
|||
# |
|||
# A fatal error has been detected by the Java Runtime Environment: |
|||
# |
|||
# Internal Error (javaCalls.cpp:51), pid=25076, tid=0x0000000000002d34 |
|||
# guarantee(thread->is_Java_thread()) failed: crucial check - the VM thread cannot and must not escape to Java code |
|||
# |
|||
# JRE version: Java(TM) SE Runtime Environment (8.0_371) (build 1.8.0_371-b11) |
|||
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.371-b11 mixed mode windows-amd64 compressed oops) |
|||
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows |
|||
# |
|||
# If you would like to submit a bug report, please visit: |
|||
# http://bugreport.java.com/bugreport/crash.jsp |
|||
# |
|||
|
|||
--------------- T H R E A D --------------- |
|||
|
|||
Current thread (0x000001ded177d800): VMThread [stack: 0x0000008ab0f00000,0x0000008ab1000000] [id=11572] |
|||
|
|||
Stack: [0x0000008ab0f00000,0x0000008ab1000000] |
|||
[error occurred during error reporting (printing stack bounds), id 0xc0000005] |
|||
|
|||
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) |
|||
V [jvm.dll+0x34d9f9] |
|||
V [jvm.dll+0x28aa12] |
|||
V [jvm.dll+0x28b5dd] |
|||
V [jvm.dll+0x2a9756] |
|||
V [jvm.dll+0x2aa430] |
|||
V [jvm.dll+0x34d658] |
|||
C [ntdll.dll+0xa28bf] |
|||
C [ntdll.dll+0x52554] |
|||
C [ntdll.dll+0xa13ce] |
|||
C 0x000001ded8410b4a |
|||
|
|||
VM_Operation (0x0000008ab14ff540): GetOrSetLocal, mode: safepoint, requested by thread 0x000001deeec74800 |
|||
|
|||
|
|||
--------------- P R O C E S S --------------- |
|||
|
|||
Java Threads: ( => current thread ) |
|||
0x000001def3bc5800 JavaThread "kafka-coordinator-heartbeat-thread | vote-group" daemon [_thread_blocked, id=28744, stack(0x0000008ab5200000,0x0000008ab5300000)] |
|||
0x000001def3bc9000 JavaThread "http-nio-8091-Acceptor" daemon [_thread_blocked, id=32148, stack(0x0000008ab5100000,0x0000008ab5200000)] |
|||
0x000001def3bc1800 JavaThread "http-nio-8091-ClientPoller" daemon [_thread_blocked, id=32608, stack(0x0000008ab5000000,0x0000008ab5100000)] |
|||
0x000001def3bc7000 JavaThread "http-nio-8091-exec-10" daemon [_thread_blocked, id=31348, stack(0x0000008ab4f00000,0x0000008ab5000000)] |
|||
0x000001def3bc8800 JavaThread "http-nio-8091-exec-9" daemon [_thread_blocked, id=15980, stack(0x0000008ab4e00000,0x0000008ab4f00000)] |
|||
0x000001def39b5000 JavaThread "http-nio-8091-exec-8" daemon [_thread_blocked, id=29748, stack(0x0000008ab4d00000,0x0000008ab4e00000)] |
|||
0x000001def39bb000 JavaThread "http-nio-8091-exec-7" daemon [_thread_blocked, id=33636, stack(0x0000008ab4c00000,0x0000008ab4d00000)] |
|||
0x000001def39ba800 JavaThread "http-nio-8091-exec-6" daemon [_thread_blocked, id=23340, stack(0x0000008ab4b00000,0x0000008ab4c00000)] |
|||
0x000001def39b9000 JavaThread "http-nio-8091-exec-5" daemon [_thread_blocked, id=18916, stack(0x0000008ab4a00000,0x0000008ab4b00000)] |
|||
0x000001def39b8000 JavaThread "http-nio-8091-exec-4" daemon [_thread_blocked, id=23868, stack(0x0000008ab4900000,0x0000008ab4a00000)] |
|||
0x000001def39b9800 JavaThread "http-nio-8091-exec-3" daemon [_thread_blocked, id=29744, stack(0x0000008ab4800000,0x0000008ab4900000)] |
|||
0x000001def39b7800 JavaThread "http-nio-8091-exec-2" daemon [_thread_blocked, id=23860, stack(0x0000008ab4700000,0x0000008ab4800000)] |
|||
0x000001def39b6800 JavaThread "http-nio-8091-exec-1" daemon [_thread_blocked, id=14900, stack(0x0000008ab4600000,0x0000008ab4700000)] |
|||
0x000001def39bc000 JavaThread "http-nio-8091-BlockPoller" daemon [_thread_blocked, id=16256, stack(0x0000008ab4400000,0x0000008ab4500000)] |
|||
0x000001def39b6000 JavaThread "org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1" [_thread_blocked, id=17664, stack(0x0000008ab4300000,0x0000008ab4400000)] |
|||
0x000001def39ad800 JavaThread "ThreadPoolTaskScheduler-1" [_thread_blocked, id=3736, stack(0x0000008ab4200000,0x0000008ab4300000)] |
|||
0x000001def39b4800 JavaThread "File Watcher" daemon [_thread_blocked, id=744, stack(0x0000008ab4100000,0x0000008ab4200000)] |
|||
0x000001def39b3000 JavaThread "lettuce-eventExecutorLoop-62-16" daemon [_thread_blocked, id=31540, stack(0x0000008ab3f00000,0x0000008ab4000000)] |
|||
0x000001def39b2000 JavaThread "lettuce-eventExecutorLoop-62-15" daemon [_thread_blocked, id=14556, stack(0x0000008ab3e00000,0x0000008ab3f00000)] |
|||
0x000001def39b0000 JavaThread "lettuce-eventExecutorLoop-62-14" daemon [_thread_blocked, id=4308, stack(0x0000008ab3d00000,0x0000008ab3e00000)] |
|||
0x000001def39af000 JavaThread "lettuce-eventExecutorLoop-62-13" daemon [_thread_blocked, id=31568, stack(0x0000008ab3c00000,0x0000008ab3d00000)] |
|||
0x000001def39ae800 JavaThread "lettuce-eventExecutorLoop-62-12" daemon [_thread_blocked, id=29328, stack(0x0000008ab3b00000,0x0000008ab3c00000)] |
|||
0x000001def39ad000 JavaThread "lettuce-eventExecutorLoop-62-11" daemon [_thread_blocked, id=31384, stack(0x0000008ab3a00000,0x0000008ab3b00000)] |
|||
0x000001def4160000 JavaThread "lettuce-eventExecutorLoop-62-10" daemon [_thread_blocked, id=28416, stack(0x0000008ab3900000,0x0000008ab3a00000)] |
|||
0x000001def415f800 JavaThread "lettuce-eventExecutorLoop-62-9" daemon [_thread_blocked, id=33712, stack(0x0000008ab3800000,0x0000008ab3900000)] |
|||
0x000001def415d000 JavaThread "lettuce-eventExecutorLoop-62-8" daemon [_thread_blocked, id=1852, stack(0x0000008ab3700000,0x0000008ab3800000)] |
|||
0x000001def415e000 JavaThread "lettuce-eventExecutorLoop-62-7" daemon [_thread_blocked, id=20324, stack(0x0000008ab3600000,0x0000008ab3700000)] |
|||
0x000001def415c800 JavaThread "lettuce-eventExecutorLoop-62-6" daemon [_thread_blocked, id=19420, stack(0x0000008ab3500000,0x0000008ab3600000)] |
|||
0x000001def415e800 JavaThread "lettuce-eventExecutorLoop-62-5" daemon [_thread_blocked, id=22788, stack(0x0000008ab3400000,0x0000008ab3500000)] |
|||
0x000001def4155000 JavaThread "lettuce-eventExecutorLoop-62-4" daemon [_thread_blocked, id=25488, stack(0x0000008ab3300000,0x0000008ab3400000)] |
|||
0x000001def415b800 JavaThread "lettuce-eventExecutorLoop-62-3" daemon [_thread_blocked, id=32320, stack(0x0000008ab3200000,0x0000008ab3300000)] |
|||
0x000001def415b000 JavaThread "lettuce-eventExecutorLoop-62-2" daemon [_thread_blocked, id=30908, stack(0x0000008ab3100000,0x0000008ab3200000)] |
|||
0x000001def415a000 JavaThread "lettuce-eventExecutorLoop-62-1" daemon [_thread_blocked, id=27428, stack(0x0000008ab3000000,0x0000008ab3100000)] |
|||
0x000001def4159800 JavaThread "lettuce-nioEventLoop-64-1" daemon [_thread_in_native, id=25588, stack(0x0000008ab2d00000,0x0000008ab2e00000)] |
|||
0x000001def4152000 JavaThread "HwgoldHikariCP housekeeper" daemon [_thread_blocked, id=26692, stack(0x0000008ab2c00000,0x0000008ab2d00000)] |
|||
0x000001def4158800 JavaThread "lettuce-timer-63-1" [_thread_blocked, id=26464, stack(0x0000008ab2b00000,0x0000008ab2c00000)] |
|||
0x000001def4154000 JavaThread "container-0" [_thread_blocked, id=23992, stack(0x0000008ab2a00000,0x0000008ab2b00000)] |
|||
0x000001def4157000 JavaThread "Catalina-utility-2" [_thread_blocked, id=8032, stack(0x0000008ab2900000,0x0000008ab2a00000)] |
|||
0x000001def4151000 JavaThread "Catalina-utility-1" [_thread_blocked, id=25140, stack(0x0000008aafd00000,0x0000008aafe00000)] |
|||
0x000001def4156800 JavaThread "DestroyJavaVM" [_thread_blocked, id=13124, stack(0x0000008ab0100000,0x0000008ab0200000)] |
|||
0x000001def3bc4000 JavaThread "Live Reload Server" daemon [_thread_in_native, id=28364, stack(0x0000008ab4500000,0x0000008ab4600000)] |
|||
0x000001deeecfa000 JavaThread "mysql-cj-abandoned-connection-cleanup" daemon [_thread_blocked, id=13352, stack(0x0000008ab2e00000,0x0000008ab2f00000)] |
|||
0x000001def0df7000 JavaThread "RMI Scheduler(0)" daemon [_thread_blocked, id=6252, stack(0x0000008ab2700000,0x0000008ab2800000)] |
|||
0x000001def0c06000 JavaThread "RMI TCP Accept-0" daemon [_thread_in_native, id=24984, stack(0x0000008ab2400000,0x0000008ab2500000)] |
|||
0x000001deeed7d000 JavaThread "Service Thread" daemon [_thread_blocked, id=25552, stack(0x0000008ab2300000,0x0000008ab2400000)] |
|||
0x000001deeecf8800 JavaThread "C1 CompilerThread11" daemon [_thread_blocked, id=23664, stack(0x0000008ab2200000,0x0000008ab2300000)] |
|||
0x000001deeecf5800 JavaThread "C1 CompilerThread10" daemon [_thread_blocked, id=23460, stack(0x0000008ab2100000,0x0000008ab2200000)] |
|||
0x000001deeecf6000 JavaThread "C1 CompilerThread9" daemon [_thread_blocked, id=32216, stack(0x0000008ab2000000,0x0000008ab2100000)] |
|||
0x000001deeecf7800 JavaThread "C1 CompilerThread8" daemon [_thread_blocked, id=31036, stack(0x0000008ab1f00000,0x0000008ab2000000)] |
|||
0x000001deeecf7000 JavaThread "C2 CompilerThread7" daemon [_thread_blocked, id=32380, stack(0x0000008ab1e00000,0x0000008ab1f00000)] |
|||
0x000001deeecf2800 JavaThread "C2 CompilerThread6" daemon [_thread_blocked, id=19188, stack(0x0000008ab1d00000,0x0000008ab1e00000)] |
|||
0x000001deeecb7800 JavaThread "C2 CompilerThread5" daemon [_thread_blocked, id=25316, stack(0x0000008ab1c00000,0x0000008ab1d00000)] |
|||
0x000001deeecb5800 JavaThread "C2 CompilerThread4" daemon [_thread_blocked, id=15592, stack(0x0000008ab1b00000,0x0000008ab1c00000)] |
|||
0x000001deeeca8800 JavaThread "C2 CompilerThread3" daemon [_thread_blocked, id=7648, stack(0x0000008ab1a00000,0x0000008ab1b00000)] |
|||
0x000001deeeca2800 JavaThread "C2 CompilerThread2" daemon [_thread_blocked, id=32860, stack(0x0000008ab1900000,0x0000008ab1a00000)] |
|||
0x000001deeec93800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=15684, stack(0x0000008ab1800000,0x0000008ab1900000)] |
|||
0x000001deeec92000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=13424, stack(0x0000008ab1700000,0x0000008ab1800000)] |
|||
0x000001deeec79800 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=19256, stack(0x0000008ab1600000,0x0000008ab1700000)] |
|||
0x000001deeec78800 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=30992, stack(0x0000008ab1500000,0x0000008ab1600000)] |
|||
0x000001deeec74800 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=11428, stack(0x0000008ab1400000,0x0000008ab1500000)] |
|||
0x000001deeec4a800 JavaThread "Attach Listener" daemon [_thread_blocked, id=18076, stack(0x0000008ab1300000,0x0000008ab1400000)] |
|||
0x000001deeebf2800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=28564, stack(0x0000008ab1200000,0x0000008ab1300000)] |
|||
0x000001deecece800 JavaThread "Finalizer" daemon [_thread_blocked, id=6584, stack(0x0000008ab1100000,0x0000008ab1200000)] |
|||
0x000001deeebe2000 JavaThread "Reference Handler" daemon [_thread_blocked, id=30456, stack(0x0000008ab1000000,0x0000008ab1100000)] |
|||
|
|||
Other Threads: |
|||
=>0x000001ded177d800 VMThread [stack: 0x0000008ab0f00000,0x0000008ab1000000] [id=11572] |
|||
0x000001def0c20000 WatcherThread [stack: 0x0000008ab2500000,0x0000008ab2600000] [id=22148] |
|||
|
|||
VM state:at safepoint (normal execution) |
|||
|
|||
VM Mutex/Monitor currently owned by a thread: ([mutex/lock_event]) |
|||
[0x000001ded16ed270] Threads_lock - owner thread: 0x000001ded177d800 |
|||
|
|||
heap address: 0x0000000081200000, size: 2030 MB, Compressed Oops mode: 32-bit |
|||
Narrow klass base: 0x0000000000000000, Narrow klass shift: 3 |
|||
Compressed class space size: 1073741824 Address: 0x0000000100000000 |
|||
|
|||
Heap: |
|||
PSYoungGen total 244224K, used 129333K [0x00000000d5b80000, 0x00000000e5480000, 0x0000000100000000) |
|||
eden space 233472K, 55% used [0x00000000d5b80000,0x00000000dd9cd438,0x00000000e3f80000) |
|||
from space 10752K, 0% used [0x00000000e4a00000,0x00000000e4a00000,0x00000000e5480000) |
|||
to space 10752K, 0% used [0x00000000e3f80000,0x00000000e3f80000,0x00000000e4a00000) |
|||
ParOldGen total 136192K, used 28542K [0x0000000081200000, 0x0000000089700000, 0x00000000d5b80000) |
|||
object space 136192K, 20% used [0x0000000081200000,0x0000000082ddf8c8,0x0000000089700000) |
|||
Metaspace used 67607K, capacity 74680K, committed 75008K, reserved 1114112K |
|||
class space used 8711K, capacity 10132K, committed 10240K, reserved 1048576K |
|||
|
|||
Card table byte_map: [0x000001dee77d0000,0x000001dee7bd0000] byte_map_base: 0x000001dee73c7000 |
|||
|
|||
Marking Bits: (ParMarkBitMap*) 0x00000000622fd980 |
|||
Begin Bits: [0x000001dee7e80000, 0x000001dee9e38000) |
|||
End Bits: [0x000001dee9e38000, 0x000001deebdf0000) |
|||
|
|||
Polling page: 0x000001ded33e0000 |
|||
|
|||
CodeCache: size=245760Kb used=25097Kb max_used=25097Kb free=220662Kb |
|||
bounds [0x000001ded8410000, 0x000001ded9ca0000, 0x000001dee7410000] |
|||
total_blobs=12855 nmethods=12196 adapters=574 |
|||
compilation: enabled |
|||
|
|||
Compilation events (10 events): |
|||
Event: 1499.885 Thread 0x000001deeecf7800 12345 1 org.apache.kafka.clients.consumer.KafkaConsumer::poll (16 bytes) |
|||
Event: 1499.885 Thread 0x000001deeecf8800 nmethod 12344 0x000001ded9c8fed0 code [0x000001ded9c90140, 0x000001ded9c90ba0] |
|||
Event: 1499.886 Thread 0x000001deeecf7800 nmethod 12345 0x000001ded9c91510 code [0x000001ded9c91680, 0x000001ded9c91800] |
|||
Event: 1499.886 Thread 0x000001deeecf8800 12346 1 org.apache.kafka.clients.consumer.internals.KafkaConsumerMetrics::recordPollStart (46 bytes) |
|||
Event: 1499.886 Thread 0x000001deeecf5800 nmethod 12343 0x000001ded9c91890 code [0x000001ded9c91b20, 0x000001ded9c92960] |
|||
Event: 1499.886 Thread 0x000001deeecf8800 nmethod 12346 0x000001ded9c93910 code [0x000001ded9c93a80, 0x000001ded9c93ce0] |
|||
Event: 1502.753 Thread 0x000001deeecf7800 12347 1 org.apache.coyote.Request::getRequestProcessor (5 bytes) |
|||
Event: 1502.753 Thread 0x000001deeecf7800 nmethod 12347 0x000001ded9c93f10 code [0x000001ded9c94060, 0x000001ded9c94178] |
|||
Event: 1502.758 Thread 0x000001deeecf6000 12348 1 org.springframework.core.MethodParameter::getParameterAnnotation (47 bytes) |
|||
Event: 1502.758 Thread 0x000001deeecf6000 nmethod 12348 0x000001ded9c941d0 code [0x000001ded9c94340, 0x000001ded9c94530] |
|||
|
|||
GC Heap History (10 events): |
|||
Event: 1451.740 GC heap before |
|||
{Heap before GC invocations=49 (full 21): |
|||
PSYoungGen total 244224K, used 4991K [0x00000000d5b80000, 0x00000000e5580000, 0x0000000100000000) |
|||
eden space 233472K, 0% used [0x00000000d5b80000,0x00000000d5b80000,0x00000000e3f80000) |
|||
from space 10752K, 46% used [0x00000000e4b00000,0x00000000e4fdfc28,0x00000000e5580000) |
|||
to space 11264K, 0% used [0x00000000e3f80000,0x00000000e3f80000,0x00000000e4a80000) |
|||
ParOldGen total 136192K, used 28180K [0x0000000081200000, 0x0000000089700000, 0x00000000d5b80000) |
|||
object space 136192K, 20% used [0x0000000081200000,0x0000000082d85198,0x0000000089700000) |
|||
Metaspace used 66446K, capacity 73258K, committed 73472K, reserved 1112064K |
|||
class space used 8590K, capacity 9980K, committed 9984K, reserved 1048576K |
|||
Event: 1451.914 GC heap after |
|||
Heap after GC invocations=49 (full 21): |
|||
PSYoungGen total 244224K, used 0K [0x00000000d5b80000, 0x00000000e5580000, 0x0000000100000000) |
|||
eden space 233472K, 0% used [0x00000000d5b80000,0x00000000d5b80000,0x00000000e3f80000) |
|||
from space 10752K, 0% used [0x00000000e4b00000,0x00000000e4b00000,0x00000000e5580000) |
|||
to space 11264K, 0% used [0x00000000e3f80000,0x00000000e3f80000,0x00000000e4a80000) |
|||
ParOldGen total 136192K, used 27964K [0x0000000081200000, 0x0000000089700000, 0x00000000d5b80000) |
|||
object space 136192K, 20% used [0x0000000081200000,0x0000000082d4f130,0x0000000089700000) |
|||
Metaspace used 66435K, capacity 73240K, committed 73472K, reserved 1112064K |
|||
class space used 8589K, capacity 9976K, committed 9984K, reserved 1048576K |
|||
} |
|||
Event: 1483.530 GC heap before |
|||
{Heap before GC invocations=50 (full 21): |
|||
PSYoungGen total 244224K, used 149310K [0x00000000d5b80000, 0x00000000e5580000, 0x0000000100000000) |
|||
eden space 233472K, 63% used [0x00000000d5b80000,0x00000000ded4f900,0x00000000e3f80000) |
|||
from space 10752K, 0% used [0x00000000e4b00000,0x00000000e4b00000,0x00000000e5580000) |
|||
to space 11264K, 0% used [0x00000000e3f80000,0x00000000e3f80000,0x00000000e4a80000) |
|||
ParOldGen total 136192K, used 27964K [0x0000000081200000, 0x0000000089700000, 0x00000000d5b80000) |
|||
object space 136192K, 20% used [0x0000000081200000,0x0000000082d4f130,0x0000000089700000) |
|||
Metaspace used 66640K, capacity 73442K, committed 73600K, reserved 1112064K |
|||
class space used 8613K, capacity 10020K, committed 10112K, reserved 1048576K |
|||
Event: 1483.538 GC heap after |
|||
Heap after GC invocations=50 (full 21): |
|||
PSYoungGen total 238592K, used 5036K [0x00000000d5b80000, 0x00000000e5480000, 0x0000000100000000) |
|||
eden space 233472K, 0% used [0x00000000d5b80000,0x00000000d5b80000,0x00000000e3f80000) |
|||
from space 5120K, 98% used [0x00000000e3f80000,0x00000000e446b238,0x00000000e4480000) |
|||
to space 10752K, 0% used [0x00000000e4a00000,0x00000000e4a00000,0x00000000e5480000) |
|||
ParOldGen total 136192K, used 27972K [0x0000000081200000, 0x0000000089700000, 0x00000000d5b80000) |
|||
object space 136192K, 20% used [0x0000000081200000,0x0000000082d51130,0x0000000089700000) |
|||
Metaspace used 66640K, capacity 73442K, committed 73600K, reserved 1112064K |
|||
class space used 8613K, capacity 10020K, committed 10112K, reserved 1048576K |
|||
} |
|||
Event: 1483.538 GC heap before |
|||
{Heap before GC invocations=51 (full 22): |
|||
PSYoungGen total 238592K, used 5036K [0x00000000d5b80000, 0x00000000e5480000, 0x0000000100000000) |
|||
eden space 233472K, 0% used [0x00000000d5b80000,0x00000000d5b80000,0x00000000e3f80000) |
|||
from space 5120K, 98% used [0x00000000e3f80000,0x00000000e446b238,0x00000000e4480000) |
|||
to space 10752K, 0% used [0x00000000e4a00000,0x00000000e4a00000,0x00000000e5480000) |
|||
ParOldGen total 136192K, used 27972K [0x0000000081200000, 0x0000000089700000, 0x00000000d5b80000) |
|||
object space 136192K, 20% used [0x0000000081200000,0x0000000082d51130,0x0000000089700000) |
|||
Metaspace used 66640K, capacity 73442K, committed 73600K, reserved 1112064K |
|||
class space used 8613K, capacity 10020K, committed 10112K, reserved 1048576K |
|||
Event: 1483.667 GC heap after |
|||
Heap after GC invocations=51 (full 22): |
|||
PSYoungGen total 238592K, used 0K [0x00000000d5b80000, 0x00000000e5480000, 0x0000000100000000) |
|||
eden space 233472K, 0% used [0x00000000d5b80000,0x00000000d5b80000,0x00000000e3f80000) |
|||
from space 5120K, 0% used [0x00000000e3f80000,0x00000000e3f80000,0x00000000e4480000) |
|||
to space 10752K, 0% used [0x00000000e4a00000,0x00000000e4a00000,0x00000000e5480000) |
|||
ParOldGen total 136192K, used 28127K [0x0000000081200000, 0x0000000089700000, 0x00000000d5b80000) |
|||
object space 136192K, 20% used [0x0000000081200000,0x0000000082d77eb0,0x0000000089700000) |
|||
Metaspace used 66630K, capacity 73424K, committed 73600K, reserved 1112064K |
|||
class space used 8611K, capacity 10016K, committed 10112K, reserved 1048576K |
|||
} |
|||
Event: 1492.464 GC heap before |
|||
{Heap before GC invocations=52 (full 22): |
|||
PSYoungGen total 238592K, used 143859K [0x00000000d5b80000, 0x00000000e5480000, 0x0000000100000000) |
|||
eden space 233472K, 61% used [0x00000000d5b80000,0x00000000de7fce18,0x00000000e3f80000) |
|||
from space 5120K, 0% used [0x00000000e3f80000,0x00000000e3f80000,0x00000000e4480000) |
|||
to space 10752K, 0% used [0x00000000e4a00000,0x00000000e4a00000,0x00000000e5480000) |
|||
ParOldGen total 136192K, used 28127K [0x0000000081200000, 0x0000000089700000, 0x00000000d5b80000) |
|||
object space 136192K, 20% used [0x0000000081200000,0x0000000082d77eb0,0x0000000089700000) |
|||
Metaspace used 66971K, capacity 73792K, committed 73856K, reserved 1114112K |
|||
class space used 8656K, capacity 10093K, committed 10112K, reserved 1048576K |
|||
Event: 1492.472 GC heap after |
|||
Heap after GC invocations=52 (full 22): |
|||
PSYoungGen total 244224K, used 5356K [0x00000000d5b80000, 0x00000000e5480000, 0x0000000100000000) |
|||
eden space 233472K, 0% used [0x00000000d5b80000,0x00000000d5b80000,0x00000000e3f80000) |
|||
from space 10752K, 49% used [0x00000000e4a00000,0x00000000e4f3b048,0x00000000e5480000) |
|||
to space 10752K, 0% used [0x00000000e3f80000,0x00000000e3f80000,0x00000000e4a00000) |
|||
ParOldGen total 136192K, used 28135K [0x0000000081200000, 0x0000000089700000, 0x00000000d5b80000) |
|||
object space 136192K, 20% used [0x0000000081200000,0x0000000082d79eb0,0x0000000089700000) |
|||
Metaspace used 66971K, capacity 73792K, committed 73856K, reserved 1114112K |
|||
class space used 8656K, capacity 10093K, committed 10112K, reserved 1048576K |
|||
} |
|||
Event: 1492.472 GC heap before |
|||
{Heap before GC invocations=53 (full 23): |
|||
PSYoungGen total 244224K, used 5356K [0x00000000d5b80000, 0x00000000e5480000, 0x0000000100000000) |
|||
eden space 233472K, 0% used [0x00000000d5b80000,0x00000000d5b80000,0x00000000e3f80000) |
|||
from space 10752K, 49% used [0x00000000e4a00000,0x00000000e4f3b048,0x00000000e5480000) |
|||
to space 10752K, 0% used [0x00000000e3f80000,0x00000000e3f80000,0x00000000e4a00000) |
|||
ParOldGen total 136192K, used 28135K [0x0000000081200000, 0x0000000089700000, 0x00000000d5b80000) |
|||
object space 136192K, 20% used [0x0000000081200000,0x0000000082d79eb0,0x0000000089700000) |
|||
Metaspace used 66971K, capacity 73792K, committed 73856K, reserved 1114112K |
|||
class space used 8656K, capacity 10093K, committed 10112K, reserved 1048576K |
|||
Event: 1492.655 GC heap after |
|||
Heap after GC invocations=53 (full 23): |
|||
PSYoungGen total 244224K, used 0K [0x00000000d5b80000, 0x00000000e5480000, 0x0000000100000000) |
|||
eden space 233472K, 0% used [0x00000000d5b80000,0x00000000d5b80000,0x00000000e3f80000) |
|||
from space 10752K, 0% used [0x00000000e4a00000,0x00000000e4a00000,0x00000000e5480000) |
|||
to space 10752K, 0% used [0x00000000e3f80000,0x00000000e3f80000,0x00000000e4a00000) |
|||
ParOldGen total 136192K, used 28542K [0x0000000081200000, 0x0000000089700000, 0x00000000d5b80000) |
|||
object space 136192K, 20% used [0x0000000081200000,0x0000000082ddf8c8,0x0000000089700000) |
|||
Metaspace used 66961K, capacity 73774K, committed 73856K, reserved 1114112K |
|||
class space used 8654K, capacity 10089K, committed 10112K, reserved 1048576K |
|||
} |
|||
|
|||
Deoptimization events (0 events): |
|||
No events |
|||
|
|||
Classes redefined (10 events): |
|||
Event: 2170.327 Thread 0x000001ded177d800 redefined class name=com.lh.controller.VoteController, count=15 |
|||
Event: 2170.396 Thread 0x000001ded177d800 redefined class name=com.lh.controller.VoteController, count=14 |
|||
Event: 2170.460 Thread 0x000001ded177d800 redefined class name=com.lh.controller.VoteController, count=13 |
|||
Event: 2170.519 Thread 0x000001ded177d800 redefined class name=com.lh.controller.VoteController, count=12 |
|||
Event: 2170.577 Thread 0x000001ded177d800 redefined class name=com.lh.controller.VoteController, count=11 |
|||
Event: 2170.638 Thread 0x000001ded177d800 redefined class name=com.lh.controller.VoteController, count=10 |
|||
Event: 2170.704 Thread 0x000001ded177d800 redefined class name=com.lh.controller.VoteController, count=9 |
|||
Event: 2170.771 Thread 0x000001ded177d800 redefined class name=com.lh.controller.VoteController, count=8 |
|||
Event: 2170.841 Thread 0x000001ded177d800 redefined class name=com.lh.controller.VoteController, count=7 |
|||
Event: 2170.910 Thread 0x000001ded177d800 redefined class name=com.lh.controller.VoteController, count=6 |
|||
|
|||
Internal exceptions (10 events): |
|||
Event: 1491.925 Thread 0x000001def4151000 Exception <a 'java/net/SocketException': Software caused connection abort: socket write error> (0x00000000ddd1ee90) thrown at [C:\jenkins\workspace\8-2-build-windows-x64-cygwin\jdk8u371\3355\hotspot\src\share\vm\prims\jni.cpp, line 737] |
|||
Event: 1491.925 Thread 0x000001def4151000 Exception <a 'java/net/SocketException': Software caused connection abort: recv failed> (0x00000000ddd1f350) thrown at [C:\jenkins\workspace\8-2-build-windows-x64-cygwin\jdk8u371\3355\hotspot\src\share\vm\prims\jni.cpp, line 737] |
|||
Event: 1491.927 Thread 0x000001def4151000 Exception <a 'java/net/SocketException': Software caused connection abort: recv failed> (0x00000000ddd20b70) thrown at [C:\jenkins\workspace\8-2-build-windows-x64-cygwin\jdk8u371\3355\hotspot\src\share\vm\prims\jni.cpp, line 737] |
|||
Event: 1491.928 Thread 0x000001def4151000 Exception <a 'java/net/SocketException': Software caused connection abort: recv failed> (0x00000000ddd22390) thrown at [C:\jenkins\workspace\8-2-build-windows-x64-cygwin\jdk8u371\3355\hotspot\src\share\vm\prims\jni.cpp, line 737] |
|||
Event: 1491.929 Thread 0x000001def4151000 Exception <a 'java/net/SocketException': Software caused connection abort: socket write error> (0x00000000ddd23988) thrown at [C:\jenkins\workspace\8-2-build-windows-x64-cygwin\jdk8u371\3355\hotspot\src\share\vm\prims\jni.cpp, line 737] |
|||
Event: 1491.930 Thread 0x000001def4151000 Exception <a 'java/net/SocketException': Software caused connection abort: recv failed> (0x00000000ddd23e48) thrown at [C:\jenkins\workspace\8-2-build-windows-x64-cygwin\jdk8u371\3355\hotspot\src\share\vm\prims\jni.cpp, line 737] |
|||
Event: 1492.232 Thread 0x000001def3bcd000 Exception <a 'java/lang/InterruptedException': sleep interrupted> (0x00000000de6d90e0) thrown at [C:\jenkins\workspace\8-2-build-windows-x64-cygwin\jdk8u371\3355\hotspot\src\share\vm\prims\jvm.cpp, line 3359] |
|||
Event: 1493.074 Thread 0x000001def4155800 Exception <a 'java/io/FileNotFoundException'> (0x00000000d5d58770) thrown at [C:\jenkins\workspace\8-2-build-windows-x64-cygwin\jdk8u371\3355\hotspot\src\share\vm\prims\jni.cpp, line 710] |
|||
Event: 1494.277 Thread 0x000001def4155800 Exception <a 'java/io/FileNotFoundException'> (0x00000000d8ce6df0) thrown at [C:\jenkins\workspace\8-2-build-windows-x64-cygwin\jdk8u371\3355\hotspot\src\share\vm\prims\jni.cpp, line 710] |
|||
Event: 1494.321 Thread 0x000001def4155800 Exception <a 'java/io/FileNotFoundException'> (0x00000000d8e4edb8) thrown at [C:\jenkins\workspace\8-2-build-windows-x64-cygwin\jdk8u371\3355\hotspot\src\share\vm\prims\jni.cpp, line 710] |
|||
|
|||
Events (10 events): |
|||
Event: 2170.640 Executing VM operation: RedefineClasses done |
|||
Event: 2170.641 Executing VM operation: RedefineClasses |
|||
Event: 2170.706 Executing VM operation: RedefineClasses done |
|||
Event: 2170.707 Executing VM operation: RedefineClasses |
|||
Event: 2170.773 Executing VM operation: RedefineClasses done |
|||
Event: 2170.774 Executing VM operation: RedefineClasses |
|||
Event: 2170.844 Executing VM operation: RedefineClasses done |
|||
Event: 2170.845 Executing VM operation: RedefineClasses |
|||
Event: 2170.912 Executing VM operation: RedefineClasses done |
|||
Event: 2170.915 Executing VM operation: GetOrSetLocal |
|||
|
|||
|
|||
Dynamic libraries: |
|||
0x00007ff739000000 - 0x00007ff73904a000 D:\Devapp\Java\jdk-1.8\bin\java.exe |
|||
0x00007ffb5d970000 - 0x00007ffb5db68000 C:\Windows\SYSTEM32\ntdll.dll |
|||
0x00007ffb5cd30000 - 0x00007ffb5cdf2000 C:\Windows\System32\KERNEL32.DLL |
|||
0x00007ffb5b310000 - 0x00007ffb5b60e000 C:\Windows\System32\KERNELBASE.dll |
|||
0x00007ffb443c0000 - 0x00007ffb443d7000 C:\InetPub\ftproot\Tipray\Ldterm\ghijt64.DLL |
|||
0x00007ffb5ca20000 - 0x00007ffb5cad1000 C:\Windows\System32\ADVAPI32.dll |
|||
0x00007ffb5d6d0000 - 0x00007ffb5d76e000 C:\Windows\System32\msvcrt.dll |
|||
0x00007ffb5d630000 - 0x00007ffb5d6cf000 C:\Windows\System32\sechost.dll |
|||
0x00007ffb5cae0000 - 0x00007ffb5cc03000 C:\Windows\System32\RPCRT4.dll |
|||
0x00007ffb5b1a0000 - 0x00007ffb5b1c7000 C:\Windows\System32\bcrypt.dll |
|||
0x00007ffb436b0000 - 0x00007ffb436f1000 C:\Inetpub\ftproot\Tipray\LdTerm\LdUserInjectDll64.dll |
|||
0x00007ffb5bd20000 - 0x00007ffb5bebd000 C:\Windows\System32\USER32.dll |
|||
0x00007ffb5b810000 - 0x00007ffb5b832000 C:\Windows\System32\win32u.dll |
|||
0x00007ffb5cf10000 - 0x00007ffb5cf3b000 C:\Windows\System32\GDI32.dll |
|||
0x00007ffb5b010000 - 0x00007ffb5b127000 C:\Windows\System32\gdi32full.dll |
|||
0x00007ffb5b610000 - 0x00007ffb5b6ad000 C:\Windows\System32\msvcp_win.dll |
|||
0x00007ffb5b890000 - 0x00007ffb5b990000 C:\Windows\System32\ucrtbase.dll |
|||
0x00007ffb4d2d0000 - 0x00007ffb4d56a000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.4355_none_60b8b9eb71f62e16\COMCTL32.dll |
|||
0x00007ffb44140000 - 0x00007ffb443b7000 C:\InetPub\ftproot\Tipray\Ldterm\LdHook64.dll |
|||
0x00007ffb5bad0000 - 0x00007ffb5bbfb000 C:\Windows\System32\ole32.dll |
|||
0x00007ffb5bf50000 - 0x00007ffb5c2a3000 C:\Windows\System32\combase.dll |
|||
0x00007ffb5bc00000 - 0x00007ffb5bc08000 C:\Windows\System32\PSAPI.DLL |
|||
0x00007ffb49490000 - 0x00007ffb49534000 C:\Windows\SYSTEM32\WINSPOOL.DRV |
|||
0x00007ffb5ce60000 - 0x00007ffb5cf0d000 C:\Windows\System32\shcore.dll |
|||
0x00007ffb5a990000 - 0x00007ffb5a99c000 C:\Windows\SYSTEM32\CRYPTBASE.DLL |
|||
0x00007ffb5d190000 - 0x00007ffb5d1bf000 C:\Windows\System32\IMM32.DLL |
|||
0x00007ffb44470000 - 0x00007ffb444c7000 C:\Inetpub\ftproot\Tipray\LdTerm\ghhlp64.dll |
|||
0x00007ffb44460000 - 0x00007ffb44470000 C:\InetPub\ftproot\Tipray\Ldterm\HookDataInteractionx64.dll |
|||
0x00007ffb43e40000 - 0x00007ffb43eb2000 C:\InetPub\ftproot\Tipray\Ldterm\LdSmartEnc64.dll |
|||
0x00007ffb43e30000 - 0x00007ffb43e3b000 C:\Windows\SYSTEM32\FLTLIB.DLL |
|||
0x00007ffb43700000 - 0x00007ffb4371f000 C:\Inetpub\ftproot\Tipray\LdTerm\HookCreateProcessInternal64.dll |
|||
0x00007ffb4d020000 - 0x00007ffb4d076000 C:\Inetpub\ftproot\Tipray\LdTerm\MonFileOp64.dll |
|||
0x00007ffb5c2b0000 - 0x00007ffb5ca1d000 C:\Windows\System32\SHELL32.dll |
|||
0x00007ffb5cf40000 - 0x00007ffb5cf95000 C:\Windows\System32\SHLWAPI.dll |
|||
0x00007ffb4d600000 - 0x00007ffb4d61b000 D:\Devapp\Java\jdk-1.8\jre\bin\vcruntime140.dll |
|||
0x00007ffb54610000 - 0x00007ffb5461c000 D:\Devapp\Java\jdk-1.8\jre\bin\vcruntime140_1.dll |
|||
0x00007ffb31b80000 - 0x00007ffb31c0e000 D:\Devapp\Java\jdk-1.8\jre\bin\msvcp140.dll |
|||
0x0000000061ad0000 - 0x0000000062377000 D:\Devapp\Java\jdk-1.8\jre\bin\server\jvm.dll |
|||
0x00007ffb4d5f0000 - 0x00007ffb4d5f9000 C:\Windows\SYSTEM32\WSOCK32.dll |
|||
0x00007ffb546e0000 - 0x00007ffb546ea000 C:\Windows\SYSTEM32\VERSION.dll |
|||
0x00007ffb5ba60000 - 0x00007ffb5bacb000 C:\Windows\System32\WS2_32.dll |
|||
0x00007ffb4e450000 - 0x00007ffb4e477000 C:\Windows\SYSTEM32\WINMM.dll |
|||
0x00007ffb58f20000 - 0x00007ffb58f32000 C:\Windows\SYSTEM32\kernel.appcore.dll |
|||
0x00007ffb4d0d0000 - 0x00007ffb4d0e0000 D:\Devapp\Java\jdk-1.8\jre\bin\verify.dll |
|||
0x00007ffb4cda0000 - 0x00007ffb4cdcb000 D:\Devapp\Java\jdk-1.8\jre\bin\java.dll |
|||
0x00007ffb572f0000 - 0x00007ffb57326000 D:\Devapp\Java\jdk-1.8\jre\bin\jdwp.dll |
|||
0x00007ffb4a0c0000 - 0x00007ffb4a0c9000 D:\Devapp\Java\jdk-1.8\jre\bin\npt.dll |
|||
0x00007ffb3dfb0000 - 0x00007ffb3dfe4000 D:\Devapp\Java\jdk-1.8\jre\bin\instrument.dll |
|||
0x00007ffb4c960000 - 0x00007ffb4c978000 D:\Devapp\Java\jdk-1.8\jre\bin\zip.dll |
|||
0x00007ffb590b0000 - 0x00007ffb59854000 C:\Windows\SYSTEM32\windows.storage.dll |
|||
0x00007ffb5aa40000 - 0x00007ffb5aa6e000 C:\Windows\SYSTEM32\Wldp.dll |
|||
0x00007ffb5b990000 - 0x00007ffb5ba5d000 C:\Windows\System32\OLEAUT32.dll |
|||
0x00007ffb5af40000 - 0x00007ffb5af64000 C:\Windows\SYSTEM32\profapi.dll |
|||
0x00007ffb4a000000 - 0x00007ffb4a00a000 D:\Devapp\Java\jdk-1.8\jre\bin\dt_socket.dll |
|||
0x00007ffb5a7a0000 - 0x00007ffb5a80a000 C:\Windows\system32\mswsock.dll |
|||
0x00007ffb3cd30000 - 0x00007ffb3cd4c000 D:\Devapp\Java\jdk-1.8\jre\bin\net.dll |
|||
0x00007ffb5a480000 - 0x00007ffb5a54a000 C:\Windows\SYSTEM32\DNSAPI.dll |
|||
0x00007ffb5a430000 - 0x00007ffb5a46b000 C:\Windows\SYSTEM32\IPHLPAPI.DLL |
|||
0x00007ffb5bf40000 - 0x00007ffb5bf48000 C:\Windows\System32\NSI.dll |
|||
0x00007ffb53a80000 - 0x00007ffb53a8a000 C:\Windows\System32\rasadhlp.dll |
|||
0x00007ffb53060000 - 0x00007ffb530e0000 C:\Windows\System32\fwpuclnt.dll |
|||
0x00007ffb4ca50000 - 0x00007ffb4ca5d000 D:\Devapp\Java\jdk-1.8\jre\bin\management.dll |
|||
0x00007ffb34be0000 - 0x00007ffb34bf3000 D:\Devapp\Java\jdk-1.8\jre\bin\nio.dll |
|||
0x00007ffb5a9a0000 - 0x00007ffb5a9b8000 C:\Windows\SYSTEM32\CRYPTSP.dll |
|||
0x00007ffb5a050000 - 0x00007ffb5a084000 C:\Windows\system32\rsaenh.dll |
|||
0x00007ffb5af00000 - 0x00007ffb5af2e000 C:\Windows\SYSTEM32\USERENV.dll |
|||
0x00007ffb5b1d0000 - 0x00007ffb5b252000 C:\Windows\System32\bcryptprimitives.dll |
|||
0x00007ffb56ff0000 - 0x00007ffb57007000 C:\Windows\SYSTEM32\dhcpcsvc6.DLL |
|||
0x00007ffb56e10000 - 0x00007ffb56e2d000 C:\Windows\SYSTEM32\dhcpcsvc.DLL |
|||
0x00007ffb41fc0000 - 0x00007ffb41fd7000 C:\Windows\system32\napinsp.dll |
|||
0x00007ffb41fa0000 - 0x00007ffb41fbb000 C:\Windows\system32\pnrpnsp.dll |
|||
0x00007ffb41f80000 - 0x00007ffb41f95000 C:\Windows\system32\wshbth.dll |
|||
0x00007ffb571a0000 - 0x00007ffb571bd000 C:\Windows\system32\NLAapi.dll |
|||
0x00007ffb41f20000 - 0x00007ffb41f32000 C:\Windows\System32\winrnr.dll |
|||
0x00007ffb4a010000 - 0x00007ffb4a035000 D:\Devapp\Java\jdk-1.8\jre\bin\sunec.dll |
|||
0x00007ffb4ac40000 - 0x00007ffb4ac4d000 D:\Devapp\Java\jdk-1.8\jre\bin\sunmscapi.dll |
|||
0x00007ffb5b6b0000 - 0x00007ffb5b80c000 C:\Windows\System32\CRYPT32.dll |
|||
0x00007ffb5aab0000 - 0x00007ffb5aad7000 C:\Windows\SYSTEM32\ncrypt.dll |
|||
0x00007ffb5aa70000 - 0x00007ffb5aaab000 C:\Windows\SYSTEM32\NTASN1.dll |
|||
0x00007ffb58a80000 - 0x00007ffb58c64000 C:\Windows\SYSTEM32\dbghelp.dll |
|||
|
|||
VM Arguments: |
|||
jvm_args: -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:64387,suspend=y,server=n -XX:TieredStopAtLevel=1 -Xverify:none -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dmanagement.endpoints.jmx.exposure.include=* -javaagent:C:\Users\Administrator\AppData\Local\JetBrains\IntelliJIdea2023.2\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 |
|||
java_command: com.lh.VoteSystemApplication |
|||
java_class_path (initial): D:\Devapp\Java\jdk-1.8\jre\lib\charsets.jar;D:\Devapp\Java\jdk-1.8\jre\lib\deploy.jar;D:\Devapp\Java\jdk-1.8\jre\lib\ext\access-bridge-64.jar;D:\Devapp\Java\jdk-1.8\jre\lib\ext\cldrdata.jar;D:\Devapp\Java\jdk-1.8\jre\lib\ext\dnsns.jar;D:\Devapp\Java\jdk-1.8\jre\lib\ext\jaccess.jar;D:\Devapp\Java\jdk-1.8\jre\lib\ext\jfxrt.jar;D:\Devapp\Java\jdk-1.8\jre\lib\ext\localedata.jar;D:\Devapp\Java\jdk-1.8\jre\lib\ext\nashorn.jar;D:\Devapp\Java\jdk-1.8\jre\lib\ext\sunec.jar;D:\Devapp\Java\jdk-1.8\jre\lib\ext\sunjce_provider.jar;D:\Devapp\Java\jdk-1.8\jre\lib\ext\sunmscapi.jar;D:\Devapp\Java\jdk-1.8\jre\lib\ext\sunpkcs11.jar;D:\Devapp\Java\jdk-1.8\jre\lib\ext\zipfs.jar;D:\Devapp\Java\jdk-1.8\jre\lib\javaws.jar;D:\Devapp\Java\jdk-1.8\jre\lib\jce.jar;D:\Devapp\Java\jdk-1.8\jre\lib\jfr.jar;D:\Devapp\Java\jdk-1.8\jre\lib\jfxswt.jar;D:\Devapp\Java\jdk-1.8\jre\lib\jsse.jar;D:\Devapp\Java\jdk-1.8\jre\lib\management-agent.jar;D:\Devapp\Java\jdk-1.8\jre\lib\plugin.jar;D:\Devapp\Java\jdk-1.8\jre\lib\resources.jar;D:\Devapp\Java\jdk-1.8\jre\lib\rt.jar;C:\Users\Administrator\Desktop\project\vote\vote_system\target\classes;D:\repository\org\springframework\boot\spring-boot-starter-web\2.4.2\spring-boot-starter-web-2.4.2.jar;D:\repository\org\springframework\boot\spring-boot-starter\2.4.2\spring-boot-starter-2.4.2.jar;D:\repository\org\springframework\boot\spring-boot-starter-logging\2.4.2\spring-boot-starter-logging-2.4.2.jar;D:\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\repository\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;D:\repository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;D:\repository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;D:\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\repository\org\yaml\snakeyaml\1.27\snakeyaml-1.27.jar;D:\repository |
|||
Launcher Type: SUN_STANDARD |
|||
|
|||
Environment Variables: |
|||
JAVA_HOME=D:\Devapp\Java\jdk-1.8 |
|||
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\Devapp\Java\jdk-1.8\bin;D:\Devapp\go1.21.13.windows-amd64\go\bin;D:\Devapp\Git\cmd;D:\Devapp\node\;D:\Devapp\Bandizip\;D:\Devapp\Maven\apache-maven-3.9.2\bin;D:\Devapp\Memurai\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;D:\Devapp\VSCode\bin;C:\Users\Administrator\AppData\Roaming\npm |
|||
USERNAME=Administrator |
|||
OS=Windows_NT |
|||
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 45 Stepping 7, GenuineIntel |
|||
|
|||
|
|||
|
|||
--------------- S Y S T E M --------------- |
|||
|
|||
OS: Windows 10 , 64 bit Build 19041 (10.0.19041.5198) |
|||
|
|||
CPU:total 16 (initial active 16) (8 cores per cpu, 2 threads per core) family 6 model 45 stepping 7, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, aes, clmul, ht, tsc, tscinvbit, tscinv |
|||
|
|||
Memory: 4k page, physical 8307720k(752056k free), swap 18891592k(3124708k free) |
|||
|
|||
vm_info: Java HotSpot(TM) 64-Bit Server VM (25.371-b11) for windows-amd64 JRE (1.8.0_371-b11), built on Mar 17 2023 04:03:45 by "java_re" with MS VC++ 17.1 (VS2022) |
|||
|
|||
time: Wed Dec 18 21:25:20 2024 |
|||
timezone: Intel64 Family 6 Model 45 Stepping 7, GenuineIntel |
|||
elapsed time: 2171.002354 seconds (0d 0h 36m 11s) |
|||
|
@ -0,0 +1,131 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<groupId>com.lh</groupId> |
|||
<artifactId>vote_new_year_java</artifactId> |
|||
<version>0.0.2</version> |
|||
<name>vote_new_year</name> |
|||
<description>Demo project for Spring Boot</description> |
|||
<properties> |
|||
<java.version>1.8</java.version> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
|||
<spring-boot.version>2.4.2</spring-boot.version> |
|||
</properties> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-web</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.mybatis.spring.boot</groupId> |
|||
<artifactId>mybatis-spring-boot-starter</artifactId> |
|||
<version>2.1.4</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-devtools</artifactId> |
|||
<scope>runtime</scope> |
|||
<optional>true</optional> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>mysql</groupId> |
|||
<artifactId>mysql-connector-java</artifactId> |
|||
<scope>runtime</scope> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.projectlombok</groupId> |
|||
<artifactId>lombok</artifactId> |
|||
<optional>true</optional> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-test</artifactId> |
|||
<scope>test</scope> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-data-redis</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-cache</artifactId> |
|||
</dependency> |
|||
<!-- Apache HttpClient --> |
|||
<dependency> |
|||
<groupId>org.apache.httpcomponents</groupId> |
|||
<artifactId>httpclient</artifactId> |
|||
</dependency> |
|||
|
|||
<!-- Jackson --> |
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-databind</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>javax.servlet</groupId> |
|||
<artifactId>javax.servlet-api</artifactId> |
|||
</dependency> |
|||
|
|||
<!-- pageHelper --> |
|||
<dependency> |
|||
<groupId>com.github.pagehelper</groupId> |
|||
<artifactId>pagehelper-spring-boot-starter</artifactId> |
|||
<version>2.1.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>cn.hutool</groupId> |
|||
<artifactId>hutool-all</artifactId> |
|||
<version>5.8.25</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-validation</artifactId> |
|||
</dependency> |
|||
</dependencies> |
|||
<dependencyManagement> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-dependencies</artifactId> |
|||
<version>${spring-boot.version}</version> |
|||
<type>pom</type> |
|||
<scope>import</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
</dependencyManagement> |
|||
|
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-compiler-plugin</artifactId> |
|||
<version>3.8.1</version> |
|||
<configuration> |
|||
<source>1.8</source> |
|||
<target>1.8</target> |
|||
<encoding>UTF-8</encoding> |
|||
</configuration> |
|||
</plugin> |
|||
<plugin> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-maven-plugin</artifactId> |
|||
<version>${spring-boot.version}</version> |
|||
<executions> |
|||
<execution> |
|||
<id>repackage</id> |
|||
<goals> |
|||
<goal>repackage</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
|
|||
</project> |
@ -0,0 +1,12 @@ |
|||
package com.lh; |
|||
|
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
|
|||
@SpringBootApplication(scanBasePackages = "com.lh") |
|||
public class VoteSystemApplication { |
|||
|
|||
public static void main(String[] args) { |
|||
SpringApplication.run(VoteSystemApplication.class, args); |
|||
} |
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.lh.bean; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class Candidate { |
|||
private Long id;//ID |
|||
@NotNull |
|||
private String jwcode;//精网号 |
|||
@NotNull |
|||
private String name;//候选人名称 |
|||
@NotNull |
|||
private String avatar;//头像 |
|||
private Integer votes = 0;//票数 |
|||
@NotNull |
|||
private Integer status;//状态 |
|||
private Integer location;//位置 |
|||
@NotNull |
|||
private Integer money;//价值 |
|||
private String spare1;//备用字段 |
|||
private String spare2;//备用字段 |
|||
private String spare3;//备用字段 |
|||
|
|||
|
|||
|
|||
private boolean isVoted;//是否被当前用户投票 |
|||
} |
@ -0,0 +1,82 @@ |
|||
package com.lh.bean; |
|||
|
|||
public class RespBean { |
|||
//状态码 10000-成功 10001-失败 |
|||
private Integer code; |
|||
//返回的附件信息 |
|||
private String msg; |
|||
//返回的数据 |
|||
private Object data; |
|||
|
|||
public Integer getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public void setCode(Integer code) { |
|||
this.code = code; |
|||
} |
|||
|
|||
public String getMsg() { |
|||
return msg; |
|||
} |
|||
|
|||
public void setMsg(String msg) { |
|||
this.msg = msg; |
|||
} |
|||
|
|||
public Object getData() { |
|||
return data; |
|||
} |
|||
|
|||
public void setData(Object data) { |
|||
this.data = data; |
|||
} |
|||
|
|||
public static RespBean ok() { |
|||
RespBean respBean = new RespBean(); |
|||
respBean.setCode(10000); |
|||
|
|||
return respBean; |
|||
} |
|||
|
|||
public static RespBean ok(String msg) { |
|||
RespBean respBean = new RespBean(); |
|||
respBean.setCode(10000); |
|||
respBean.setMsg(msg); |
|||
|
|||
return respBean; |
|||
} |
|||
|
|||
public static RespBean ok(String msg, Object data) { |
|||
RespBean respBean = new RespBean(); |
|||
respBean.setCode(10000); |
|||
respBean.setMsg(msg); |
|||
respBean.setData(data); |
|||
|
|||
return respBean; |
|||
} |
|||
|
|||
public static RespBean error() { |
|||
RespBean respBean = new RespBean(); |
|||
respBean.setCode(10001); |
|||
|
|||
return respBean; |
|||
} |
|||
|
|||
public static RespBean error(String msg) { |
|||
RespBean respBean = new RespBean(); |
|||
respBean.setCode(10001); |
|||
respBean.setMsg(msg); |
|||
|
|||
return respBean; |
|||
} |
|||
|
|||
public static RespBean error(String msg, Object data) { |
|||
RespBean respBean = new RespBean(); |
|||
respBean.setCode(10001); |
|||
respBean.setMsg(msg); |
|||
respBean.setData(data); |
|||
|
|||
return respBean; |
|||
} |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.lh.bean; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.time.LocalDateTime; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class Voter { |
|||
private Long id;//投票人ID |
|||
@NotNull |
|||
private String jwCode;//投票人Jwcode |
|||
private String name;//投票人姓名 |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@NotNull |
|||
private LocalDateTime voteTime;//投票时间 |
|||
@NotNull |
|||
private String candidateJwCode;//被投票人JwCode |
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.lh.bean.dto; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class TokenDTO { |
|||
private int jwcode; |
|||
private String username; |
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.lh.config; |
|||
|
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import javax.servlet.*; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.IOException; |
|||
|
|||
@Component |
|||
public class CORSFilter implements Filter { |
|||
|
|||
@Override |
|||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) |
|||
throws IOException, ServletException { |
|||
HttpServletResponse res = (HttpServletResponse) response; |
|||
res.addHeader("Access-Control-Allow-Credentials", "true"); |
|||
res.addHeader("Access-Control-Allow-Origin", "*"); |
|||
res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); |
|||
res.addHeader("Access-Control-Allow-Headers", "*"); |
|||
if (((HttpServletRequest) request).getMethod().equals("OPTIONS")) { |
|||
response.getWriter().println("ok"); |
|||
return; |
|||
} |
|||
chain.doFilter(request, response); |
|||
} |
|||
|
|||
@Override |
|||
public void destroy() { |
|||
} |
|||
|
|||
@Override |
|||
public void init(FilterConfig filterConfig) { |
|||
} |
|||
} |
@ -0,0 +1,89 @@ |
|||
package com.lh.config; |
|||
|
|||
import com.lh.bean.Candidate; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.data.redis.core.RedisTemplate; |
|||
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer; |
|||
import org.springframework.data.redis.serializer.StringRedisSerializer; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import javax.annotation.PostConstruct; |
|||
import java.util.Set; |
|||
|
|||
@Repository |
|||
public class CandidateCacheRepository { |
|||
|
|||
@Autowired |
|||
private RedisTemplate<String, Object> redisTemplate; |
|||
|
|||
@PostConstruct |
|||
public void init() { |
|||
redisTemplate.setKeySerializer(new StringRedisSerializer()); |
|||
redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer()); |
|||
redisTemplate.afterPropertiesSet(); |
|||
} |
|||
|
|||
// 保存候选人信息到 Redis |
|||
|
|||
// 保存候选人信息到 Redis |
|||
public void saveCandidate(Candidate candidate) { |
|||
String key = "candidate:" + candidate.getJwcode(); |
|||
|
|||
// 确保所有值都是字符串类型 |
|||
redisTemplate.opsForHash().put(key, "id", String.valueOf(candidate.getId())); |
|||
redisTemplate.opsForHash().put(key, "jwcode", candidate.getJwcode()); |
|||
redisTemplate.opsForHash().put(key, "name", candidate.getName()); |
|||
redisTemplate.opsForHash().put(key, "avatar", candidate.getAvatar()); |
|||
redisTemplate.opsForHash().put(key, "votes", String.valueOf(candidate.getVotes())); |
|||
|
|||
// 更新 ZSET |
|||
redisTemplate.opsForZSet().add("candidate:votes", candidate.getJwcode(), candidate.getVotes()); |
|||
} |
|||
|
|||
// 获取候选人详细信息 |
|||
public Candidate getCandidate(String jwcode) { |
|||
String key = "candidate:" + jwcode; |
|||
Candidate candidate = new Candidate(); |
|||
|
|||
Object idObj = redisTemplate.opsForHash().get(key, "id"); |
|||
if (idObj != null) { |
|||
candidate.setId(Long.parseLong(idObj.toString())); |
|||
} |
|||
|
|||
candidate.setJwcode((String) redisTemplate.opsForHash().get(key, "jwcode")); |
|||
candidate.setName((String) redisTemplate.opsForHash().get(key, "name")); |
|||
candidate.setAvatar((String) redisTemplate.opsForHash().get(key, "avatar")); |
|||
|
|||
Object votesObj = redisTemplate.opsForHash().get(key, "votes"); |
|||
if (votesObj != null) { |
|||
candidate.setVotes(Integer.parseInt(votesObj.toString())); |
|||
} |
|||
//如果id,jwcode,name,avatar,votes都为空,则返回null |
|||
if (candidate.getId() == null && candidate.getJwcode() == null && candidate.getName() == null && candidate.getAvatar() == null) { |
|||
return null; |
|||
} |
|||
|
|||
return candidate; |
|||
} |
|||
|
|||
// 获取所有候选人的 jwcode 按投票数排序 |
|||
public Set<Object> getCandidateJwCodesByVotes() { |
|||
return redisTemplate.opsForZSet().reverseRange("candidate:votes", 0, -1); |
|||
} |
|||
|
|||
// 删除 Redis 中所有候选人数据 |
|||
public void deleteAllCandidatesFromCache() { |
|||
Set<Object> jwcodes = redisTemplate.opsForZSet().range("candidate:votes", 0, -1); |
|||
if (jwcodes != null) { |
|||
for (Object jwcode : jwcodes) { |
|||
redisTemplate.delete("candidate:" + jwcode); |
|||
} |
|||
} |
|||
redisTemplate.delete("candidate:votes"); |
|||
} |
|||
//删除Redis中指定候选人数据 |
|||
public void deleteCandidateFromCache(String jwcode) { |
|||
redisTemplate.delete("candidate:" + jwcode); |
|||
redisTemplate.opsForZSet().remove("candidate:votes", jwcode); |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.lh.config; |
|||
|
|||
import com.lh.bean.RespBean; |
|||
import com.lh.exception.MyException; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.web.bind.annotation.RestControllerAdvice; |
|||
|
|||
@Configuration |
|||
@RestControllerAdvice |
|||
public class ExceptionHandler { |
|||
@org.springframework.web.bind.annotation.ExceptionHandler(MyException.class) |
|||
public RespBean myException(MyException e) { |
|||
e.printStackTrace(); |
|||
return RespBean.error(e.getMessage()); |
|||
} |
|||
|
|||
@org.springframework.web.bind.annotation.ExceptionHandler(Exception.class) |
|||
public RespBean exception(Exception e) { |
|||
e.printStackTrace(); |
|||
return RespBean.error("未知错误,请联系管理员"); |
|||
} |
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.lh.config; |
|||
|
|||
import org.springframework.cache.annotation.EnableCaching; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.data.redis.connection.RedisConnectionFactory; |
|||
import org.springframework.data.redis.core.RedisTemplate; |
|||
import org.springframework.data.redis.core.StringRedisTemplate; |
|||
import org.springframework.data.redis.serializer.StringRedisSerializer; |
|||
|
|||
@Configuration |
|||
@EnableCaching |
|||
public class RedisConfig { |
|||
@Bean |
|||
public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory connectionFactory) { |
|||
return new StringRedisTemplate(connectionFactory); |
|||
} |
|||
|
|||
@Bean |
|||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { |
|||
RedisTemplate<String, Object> template = new RedisTemplate<>(); |
|||
template.setConnectionFactory(redisConnectionFactory); |
|||
|
|||
// 设置 key 的序列化方式 |
|||
template.setKeySerializer(new StringRedisSerializer()); |
|||
|
|||
// 设置 hash key 和 hash value 的序列化方式 |
|||
template.setHashKeySerializer(new StringRedisSerializer()); |
|||
template.setHashValueSerializer(new StringRedisSerializer()); |
|||
|
|||
// 设置 value 的序列化方式 |
|||
template.setValueSerializer(new StringRedisSerializer()); |
|||
|
|||
return template; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,67 @@ |
|||
package com.lh.controller; |
|||
|
|||
import com.github.pagehelper.PageInfo; |
|||
import com.lh.bean.Candidate; |
|||
import com.lh.bean.RespBean; |
|||
import com.lh.service.CandidatesService; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
@CrossOrigin |
|||
@RestController |
|||
@RequestMapping |
|||
public class CandidateController { |
|||
@Autowired |
|||
private CandidatesService candidateService; |
|||
|
|||
//分页查询+条件查询 |
|||
@GetMapping("/getCandidatesPage") |
|||
public RespBean getCandidatesPage(@RequestParam(value = "name",defaultValue = "")String name,@RequestParam(value = "location",defaultValue = "")Integer location, @RequestParam(value = "pageNum",defaultValue = "0")Integer pageNum, @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize){ |
|||
pageNum = pageNum == 0 ? 1 : pageNum; |
|||
pageSize = pageSize == null ? 10 : pageSize; |
|||
Candidate candidate = new Candidate(); |
|||
candidate.setName(name); |
|||
candidate.setLocation(location); |
|||
PageInfo<Candidate> pageInfo = candidateService.selectCandidate(candidate, pageNum, pageSize); |
|||
return RespBean.ok("查询成功", pageInfo); |
|||
} |
|||
//添加 |
|||
@PostMapping("/addCandidate") |
|||
public RespBean addCandidate(@RequestBody Candidate candidate){ |
|||
candidateService.insertCandidate(candidate); |
|||
return RespBean.ok("添加成功:" + candidate.getJwcode()); |
|||
} |
|||
|
|||
//编辑 |
|||
@PostMapping("/updateCandidate") |
|||
public RespBean updateCandidate(@RequestBody Candidate candidate){ |
|||
candidateService.updateCandidate(candidate); |
|||
return RespBean.ok("修改成功:" + candidate.getJwcode()); |
|||
} |
|||
|
|||
//根据编号查询候选人/物品信息 |
|||
@GetMapping("/getCandidateByJwcode/{jwcode}") |
|||
public RespBean getCandidateById(@PathVariable("jwcode") String jwcode){ |
|||
return RespBean.ok("查询成功:" + jwcode, candidateService.selectCandidateByJwcode(jwcode)); |
|||
} |
|||
|
|||
//下架 |
|||
@GetMapping("/changeCandidateByJwcode/{jwcode}") |
|||
public RespBean changeCandidateByJwcode(@PathVariable("jwcode") String jwcode){ |
|||
candidateService.changeCandidateStatus(jwcode); |
|||
return RespBean.ok("状态修改成功:" + jwcode); |
|||
} |
|||
|
|||
//根据精网号查询被投票记录 |
|||
@GetMapping("/getVoterByCandidateAndVoterJwcode") |
|||
public RespBean getVoterByCandidateAndVoterJwcode(@RequestParam(value = "voterJwcode",defaultValue = "")String voterJwcode, @RequestParam(value = "candidateJwcode")String candidateJwcode){ |
|||
return RespBean.ok("查询成功:",candidateService.getVoterByCandidateAndVoterJwcode(candidateJwcode,voterJwcode)); |
|||
} |
|||
|
|||
//实际人数 |
|||
@GetMapping("/getRealCount/{candidateJwcode}") |
|||
public RespBean getRealCount(@PathVariable("candidateJwcode") String candidateJwcode){ |
|||
return RespBean.ok("实际人数", candidateService.realCount(candidateJwcode)); |
|||
} |
|||
} |
@ -0,0 +1,45 @@ |
|||
package com.lh.controller; |
|||
|
|||
import com.lh.bean.RespBean; |
|||
import com.lh.exception.MyException; |
|||
import com.lh.service.VoteService; |
|||
import com.lh.until.Utils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.io.IOException; |
|||
import java.net.URLEncoder; |
|||
import java.util.Map; |
|||
|
|||
@CrossOrigin |
|||
@RestController |
|||
@RequestMapping |
|||
public class VoteController { |
|||
@Autowired |
|||
private VoteService voteService; |
|||
//投票. |
|||
@PostMapping("/vote") |
|||
public RespBean vote(@RequestParam("code") String candidateJwcode, @RequestParam("token") String token) throws Exception { |
|||
token = "token=" + URLEncoder.encode(token,"UTF-8"); |
|||
Utils utils = new Utils(); |
|||
String voterJwcode = String.valueOf(utils.getJwcode(token)); |
|||
String voterName = utils.getUsername(token); |
|||
Integer result =voteService.insertVote(voterJwcode, candidateJwcode, voterName); |
|||
return RespBean.ok("投票成功!今日还可以投" + result + "次"); |
|||
} |
|||
//获取所有候选人 |
|||
@PostMapping ("/getCandidates") |
|||
public RespBean getCandidates(@RequestBody Map<String, String> query) throws IOException { |
|||
String token = query.get("token"); |
|||
token = "token=" + URLEncoder.encode(token, "UTF-8"); |
|||
System.out.println(token); |
|||
String voterJwcode = String.valueOf(new Utils().getJwcode(token)); |
|||
return RespBean.ok("获取成功",voteService.getCandidates(voterJwcode)); |
|||
} |
|||
|
|||
//获取某个候选人的被投票记录 |
|||
@GetMapping("/getVotesByCandidate/{candidateJwcode}") |
|||
public RespBean getVotesByCandidate(@PathVariable("candidateJwcode") String candidateJwcode) throws MyException { |
|||
return RespBean.ok("获取成功",voteService.getVotesByCandidate(candidateJwcode)); |
|||
} |
|||
} |
@ -0,0 +1,7 @@ |
|||
package com.lh.exception; |
|||
|
|||
public class MyException extends RuntimeException{ |
|||
public MyException(String msg){ |
|||
super(msg); |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.lh.mapper; |
|||
|
|||
import com.lh.bean.Candidate; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface CandidatesMapper { |
|||
//获取所有候选人 |
|||
List<Candidate> getCandidates(); |
|||
|
|||
//通过精网号搜索候选人 |
|||
Candidate getByCandidateJwcode(@Param("jwcode") String jwcode); |
|||
|
|||
//候选人票数+1 |
|||
boolean addVotes(@Param("jwcode") String jwcode); |
|||
|
|||
//新增候选人 |
|||
boolean insertCandidate(Candidate candidate); |
|||
|
|||
//编辑候选人 + 候选人状态变更 |
|||
boolean updateCandidate(Candidate candidate); |
|||
|
|||
//条件查询 |
|||
List<Candidate> selectCandidate(Candidate candidate); |
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.lh.mapper; |
|||
|
|||
import com.lh.bean.Voter; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface VoterMapper { |
|||
// 查询用户今日投票信息 |
|||
List<Voter> countVotesToday(@Param("jwcode") String jwcode); |
|||
//插入投票记录 |
|||
void insertVote(@Param("jwcode") String jwcode, @Param("candidateJwcode") String candidateJwcode,@Param("name") String namne); |
|||
//根据候选人的jwcode查询投票记录 |
|||
List<Voter> getVotesByCandidate(@Param("candidateJwcode") String candidateJwcode); |
|||
//查询该候选人的实际票数 |
|||
int countVotesByCandidate(@Param("candidateJwcode") String candidateJwcode); |
|||
//根据精网号查询详情中的投票记录 |
|||
List<Voter> getVoterByVoterAndCandidateJwcode(@Param("jwcode") String jwcode, @Param("candidateJwcode") String candidateJwcode); |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.lh.service; |
|||
|
|||
import com.github.pagehelper.PageInfo; |
|||
import com.lh.bean.Candidate; |
|||
import com.lh.bean.Voter; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface CandidatesService { |
|||
//新增候选人 |
|||
Boolean insertCandidate(Candidate candidate); |
|||
//下架候选人 |
|||
Boolean changeCandidateStatus(String candidateJwcode); |
|||
//修改候选人信息 |
|||
Boolean updateCandidate(Candidate candidate); |
|||
//条件查询+分页 |
|||
PageInfo<Candidate> selectCandidate(Candidate candidate, Integer pageNum, Integer pageSize); |
|||
//查看详情的根据精网号查询 |
|||
List<Voter> getVoterByCandidateAndVoterJwcode(String voterJwcode, String candidateJwcode); |
|||
//查看详情的实际票数 |
|||
Integer realCount(String candidateJwcode); |
|||
//根据jwocde查询 |
|||
Candidate selectCandidateByJwcode(String jwcode); |
|||
} |
@ -0,0 +1,117 @@ |
|||
package com.lh.service; |
|||
|
|||
import com.github.pagehelper.PageHelper; |
|||
import com.github.pagehelper.PageInfo; |
|||
import com.lh.bean.Candidate; |
|||
import com.lh.bean.Voter; |
|||
import com.lh.config.CandidateCacheRepository; |
|||
import com.lh.exception.MyException; |
|||
import com.lh.mapper.CandidatesMapper; |
|||
import com.lh.mapper.VoterMapper; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class CandidatesServiceImpl implements CandidatesService { |
|||
@Autowired |
|||
private CandidatesMapper candidatesMapper; |
|||
@Autowired |
|||
private VoterMapper voterMapper; |
|||
@Autowired |
|||
private CandidateCacheRepository candidateCacheRepository; |
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Boolean insertCandidate(Candidate candidate){ |
|||
if(candidate == null || candidate.getJwcode()==null || candidate.getJwcode().equals("")){ |
|||
throw new MyException("候选人/物品信息不能为空!"); |
|||
} |
|||
// 候选人Jwcode不能重复 |
|||
if(candidatesMapper.getByCandidateJwcode(candidate.getJwcode()) != null){ |
|||
throw new MyException("候选人/物品编号不能重复!"); |
|||
} |
|||
//最大数量不能超过40个 |
|||
if(candidatesMapper.getCandidates().size() >= 40){ |
|||
throw new MyException("候选人/投票物品已达到最大数量40!"); |
|||
} |
|||
candidatesMapper.insertCandidate(candidate); |
|||
if (candidate.getStatus() == 1){ |
|||
// 缓存中添加候选人信息 |
|||
candidateCacheRepository.saveCandidate(candidate); |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Boolean changeCandidateStatus(String candidateJwcode){ |
|||
Candidate candidate = candidatesMapper.getByCandidateJwcode(candidateJwcode); |
|||
//候选人不存在 |
|||
if(candidate == null){ |
|||
throw new MyException("候选人不存在!"); |
|||
} |
|||
//如果候选人状态为1,则设置为0,否则设置为1,三元运算符 |
|||
Integer status = candidate.getStatus(); |
|||
candidate = new Candidate(); |
|||
candidate.setStatus(status == 1 ? 0 : 1); |
|||
candidate.setJwcode(candidateJwcode); |
|||
candidatesMapper.updateCandidate(candidate); |
|||
//如果状态为1,则添加缓存,否则删除缓存 |
|||
if(candidate.getStatus() == 1){ |
|||
candidateCacheRepository.saveCandidate(candidate); |
|||
}else{ |
|||
candidateCacheRepository.deleteCandidateFromCache(candidateJwcode); |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Boolean updateCandidate(Candidate candidate){ |
|||
//候选人不存在 |
|||
if(candidate == null){ |
|||
throw new MyException("候选人/物品信息不能为空!"); |
|||
} |
|||
//修改后的CandidateJwcode不能与其他的候选人重复但是可以与自己重复 |
|||
if(candidatesMapper.getByCandidateJwcode(candidate.getJwcode()) != null && !candidate.getJwcode().equals(candidate.getJwcode())){ |
|||
throw new MyException("候选人/物品编号不能重复!"); |
|||
} |
|||
candidatesMapper.updateCandidate(candidate); |
|||
if (candidatesMapper.getByCandidateJwcode(candidate.getJwcode()).getStatus() == 1){ |
|||
// 缓存中修改候选人信息 |
|||
candidateCacheRepository.saveCandidate(candidate); |
|||
} else{ |
|||
candidateCacheRepository.deleteCandidateFromCache(candidate.getJwcode()); |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
//分页查询 |
|||
@Override |
|||
public PageInfo<Candidate> selectCandidate(Candidate candidate, Integer pageNum, Integer pageSize) { |
|||
//设置分页参数 |
|||
PageHelper.startPage(pageNum, pageSize); |
|||
List<Candidate> candidateList = candidatesMapper.selectCandidate(candidate); |
|||
PageInfo<Candidate> candidatePageInfo = new PageInfo<>(candidateList); |
|||
return candidatePageInfo; |
|||
} |
|||
|
|||
@Override |
|||
public List<Voter> getVoterByCandidateAndVoterJwcode(String voterJwcode, String candidateJwcode){ |
|||
return voterMapper.getVoterByVoterAndCandidateJwcode(voterJwcode,candidateJwcode); |
|||
} |
|||
|
|||
@Override |
|||
public Integer realCount(String candidateJwcode) { |
|||
return voterMapper.countVotesByCandidate(candidateJwcode); |
|||
} |
|||
|
|||
@Override |
|||
public Candidate selectCandidateByJwcode(String jwcode) { |
|||
System.out.println(candidatesMapper.getByCandidateJwcode(jwcode)); |
|||
return candidatesMapper.getByCandidateJwcode(jwcode); |
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.lh.service; |
|||
|
|||
import com.lh.bean.Candidate; |
|||
import com.lh.bean.Voter; |
|||
import com.lh.exception.MyException; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface VoteService { |
|||
//投票 |
|||
Integer insertVote(String voterJwcode, String candidateJwcode, String voterName) throws MyException; |
|||
//获取所有候选人 |
|||
List<Candidate> getCandidates(String VoterJwcode); |
|||
//获取某个候选人的被投票记录 |
|||
List<Voter> getVotesByCandidate(String candidateJwcode) throws MyException; |
|||
} |
@ -0,0 +1,191 @@ |
|||
package com.lh.service; |
|||
|
|||
import com.lh.bean.Candidate; |
|||
import com.lh.bean.Voter; |
|||
import com.lh.config.CandidateCacheRepository; |
|||
import com.lh.exception.MyException; |
|||
import com.lh.mapper.CandidatesMapper; |
|||
import com.lh.mapper.VoterMapper; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.data.redis.core.RedisTemplate; |
|||
import org.springframework.data.redis.core.StringRedisTemplate; |
|||
import org.springframework.scheduling.annotation.Async; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.annotation.PostConstruct; |
|||
import java.time.Duration; |
|||
import java.time.LocalDateTime; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Set; |
|||
import java.util.concurrent.TimeUnit; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Service |
|||
public class VoteServiceImpl implements VoteService { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(VoteServiceImpl.class); |
|||
|
|||
@Autowired |
|||
private VoterMapper voterMapper; |
|||
@Autowired |
|||
private CandidatesMapper candidatesMapper; |
|||
@Value("${vote.limit.daily}") |
|||
private int dailyVoteLimit; // 每日投票次数限制 |
|||
@Autowired |
|||
private StringRedisTemplate stringRedisTemplate; |
|||
@Autowired |
|||
private RedisTemplate<String, Object> redisTemplate; |
|||
@Autowired |
|||
private CandidateCacheRepository candidateCacheRepository; |
|||
|
|||
// 初始化时加载所有候选人数据并缓存到 Redis |
|||
@PostConstruct |
|||
public void initCandidatesCache() throws MyException { |
|||
try { |
|||
List<Candidate> candidates = candidatesMapper.getCandidates(); |
|||
candidates = candidates.stream() |
|||
.filter(candidate -> candidate.getStatus() != 0) |
|||
.collect(Collectors.toList()); |
|||
for (Candidate candidate : candidates) { |
|||
candidateCacheRepository.saveCandidate(candidate); |
|||
} |
|||
logger.info("Candidate cache initialized successfully."); |
|||
} catch (Exception e) { |
|||
logger.error("Failed to initialize candidate cache.", e); |
|||
throw new MyException("初始化候选人缓存失败"); |
|||
} |
|||
} |
|||
|
|||
// 投票 |
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Integer insertVote(String voterJwcode, String candidateJwcode, String voterName) throws MyException { |
|||
Candidate candidate = candidateCacheRepository.getCandidate(candidateJwcode); |
|||
System.out.println(candidate); |
|||
if (candidateCacheRepository.getCandidate(candidateJwcode) == null) { |
|||
throw new MyException("候选人不存在"); |
|||
} |
|||
|
|||
String redisKey = "vote_count:" + voterJwcode + ":" + LocalDateTime.now().toLocalDate(); |
|||
String currentVoteCountStr = stringRedisTemplate.opsForValue().get(redisKey); |
|||
int voteCountToday = currentVoteCountStr == null ? 0 : Integer.parseInt(currentVoteCountStr); |
|||
|
|||
if (voteCountToday >= dailyVoteLimit) { |
|||
throw new MyException("今日投票次数已达上限"); |
|||
} |
|||
|
|||
String voteStatusKey = "vote_status:" + voterJwcode + ":" + candidateJwcode; |
|||
Boolean hasVoted = stringRedisTemplate.hasKey(voteStatusKey); |
|||
if (hasVoted != null && hasVoted) { |
|||
throw new MyException("您已经为该候选人投票,不能重复投票"); |
|||
} |
|||
|
|||
String candidateKey = "candidate:" + candidateJwcode; |
|||
|
|||
// 使用 Redis 的 Hash 增加候选人投票数 |
|||
redisTemplate.opsForHash().increment(candidateKey, "votes", 1); |
|||
|
|||
// 使用 Redis 的 ZSet 增加候选人投票数 |
|||
redisTemplate.opsForZSet().incrementScore("candidate:votes", candidateJwcode, 1); |
|||
|
|||
// 更新 Redis 中的投票次数 |
|||
redisTemplate.opsForValue().increment(redisKey, 1); |
|||
|
|||
// 设置 Redis 键的过期时间为当天的23:59:59 |
|||
LocalDateTime now = LocalDateTime.now(); |
|||
LocalDateTime endOfDay = now.toLocalDate().atTime(23, 59, 59); |
|||
long secondsUntilEndOfDay = Duration.between(now, endOfDay).getSeconds(); |
|||
// 更新投票次数的过期时间 |
|||
redisTemplate.expire(redisKey, secondsUntilEndOfDay, TimeUnit.SECONDS); |
|||
// 更新投票重复键 |
|||
stringRedisTemplate.opsForValue().set(voteStatusKey, "true", secondsUntilEndOfDay, TimeUnit.SECONDS); |
|||
|
|||
// 数据库操作 |
|||
processVote(voterJwcode, candidateJwcode, voterName); |
|||
|
|||
return dailyVoteLimit - voteCountToday - 1; |
|||
} |
|||
|
|||
// 获取所有候选人 |
|||
@Override |
|||
public List<Candidate> getCandidates(String voterJwcode) { |
|||
List<Candidate> candidateList = new ArrayList<>(); |
|||
try { |
|||
Set<Object> jwcodes = candidateCacheRepository.getCandidateJwCodesByVotes(); |
|||
List<String> jwCodeList = new ArrayList<>(); |
|||
for (Object jwcode : jwcodes) { |
|||
jwCodeList.add(jwcode.toString()); |
|||
} |
|||
|
|||
for (String jwcode : jwCodeList) { |
|||
Candidate candidate = candidateCacheRepository.getCandidate(jwcode); |
|||
if (candidate != null) { |
|||
candidateList.add(candidate); |
|||
} |
|||
} |
|||
}catch(Exception e){ |
|||
//如果缓存中获取候选人失败,则从数据库中获取候选人列表 |
|||
candidateList = candidatesMapper.getCandidates(); |
|||
} |
|||
|
|||
// 插入投票记录,为 List 插入当日是否投过票的状态 |
|||
markVotedStatus(voterJwcode, candidateList); |
|||
|
|||
return candidateList; |
|||
} |
|||
|
|||
// 获取候选人被投票记录 |
|||
@Override |
|||
public List<Voter> getVotesByCandidate(String candidateJwcode) throws MyException { |
|||
try { |
|||
return voterMapper.getVotesByCandidate(candidateJwcode); |
|||
} catch (Exception e) { |
|||
throw new MyException("获取候选人投票记录失败"); |
|||
} |
|||
} |
|||
|
|||
// 为用户标记投票状态 |
|||
private void markVotedStatus(String voterJwcode, List<Candidate> candidateList) { |
|||
String voteStatusKeyPrefix = "vote_status:" + voterJwcode + ":"; |
|||
Set<String> votedKeys = stringRedisTemplate.keys(voteStatusKeyPrefix + "*"); |
|||
|
|||
if (votedKeys != null) { |
|||
for (Candidate candidate : candidateList) { |
|||
String fullKey = voteStatusKeyPrefix + candidate.getJwcode(); |
|||
if (votedKeys.contains(fullKey)) { |
|||
candidate.setVoted(true); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
//异步处理数据库操作 |
|||
@Async |
|||
@Transactional(rollbackFor = Exception.class) |
|||
protected void processVote(String voterJwcode, String candidateJwcode, String voterName) throws MyException { |
|||
// 获取候选人信息 |
|||
Candidate candidate = candidatesMapper.getByCandidateJwcode(candidateJwcode); |
|||
|
|||
// 2. 获取候选人信息 |
|||
if (candidate == null) { |
|||
throw new MyException("候选人不存在!"); |
|||
} |
|||
|
|||
// 4. 增加候选人票数 |
|||
if (!candidatesMapper.addVotes(candidateJwcode)) { |
|||
throw new MyException ("候选人票数更新失败,请联系管理员!"); |
|||
} |
|||
|
|||
// 5. 插入投票记录 |
|||
voterMapper.insertVote(voterJwcode, candidateJwcode, voterName); |
|||
|
|||
|
|||
System.out.println("投票成功!用户:" + voterJwcode + " 投给了 " + candidateJwcode); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,84 @@ |
|||
package com.lh.until; |
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
import cn.hutool.extra.spring.SpringUtil; |
|||
import cn.hutool.json.JSONUtil; |
|||
import com.lh.bean.RespBean; |
|||
import com.lh.bean.dto.TokenDTO; |
|||
import com.lh.exception.MyException; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.http.client.methods.CloseableHttpResponse; |
|||
import org.apache.http.client.methods.HttpPost; |
|||
import org.apache.http.entity.ContentType; |
|||
import org.apache.http.entity.StringEntity; |
|||
import org.apache.http.impl.client.CloseableHttpClient; |
|||
import org.apache.http.impl.client.HttpClients; |
|||
import org.apache.http.util.EntityUtils; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import javax.annotation.PostConstruct; |
|||
import java.io.IOException; |
|||
import java.nio.charset.StandardCharsets; |
|||
import java.util.Arrays; |
|||
|
|||
@Slf4j |
|||
@Component |
|||
public class Utils { |
|||
// 编码Token |
|||
static String url; |
|||
|
|||
@PostConstruct |
|||
public void initAnalysisTokenUrl() { |
|||
boolean isProd = Arrays.asList(SpringUtil.getActiveProfiles()).contains("prod"); |
|||
if (isProd) { |
|||
url = SpringUtil.getProperty("homilychart.token.analysis.url.prod"); |
|||
} else { |
|||
url = SpringUtil.getProperty("homilychart.token.analysis.url.test"); |
|||
} |
|||
} |
|||
|
|||
// 获取token中的信息 |
|||
public TokenDTO analysisToken(String token) throws IOException { |
|||
// 创建HttpClient实例 |
|||
try (CloseableHttpClient httpClient = HttpClients.createDefault()) { |
|||
// 创建POST请求 |
|||
HttpPost postRequest = new HttpPost(url); |
|||
postRequest.setHeader("Content-Type", "application/x-www-form-urlencoded"); |
|||
System.out.println(token); |
|||
// 设置请求体参数 |
|||
StringEntity entity = new StringEntity(token, ContentType.APPLICATION_FORM_URLENCODED); |
|||
postRequest.setEntity(entity); |
|||
// 发送请求并获取响应 |
|||
try (CloseableHttpResponse response = httpClient.execute(postRequest)) { |
|||
int responseCode = response.getStatusLine().getStatusCode(); // 获取状态码 |
|||
// 读取响应体 |
|||
String responseBody = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); |
|||
log.info("[Utils] exec analysisToken url:{}, requestBody:{}, responseCode:{}, responseBody:{}", url, token, responseCode, responseBody); |
|||
|
|||
// 获取不到用户状态 |
|||
if (responseCode != 200 || StrUtil.isEmpty(responseBody)) { |
|||
throw new MyException("用户状态获取失败"); |
|||
} |
|||
|
|||
// 将token进行解析为RespBean |
|||
RespBean bean = JSONUtil.toBean(responseBody, RespBean.class); |
|||
if (bean.getCode() != 200) { |
|||
throw new MyException("用户状态获取失败"); |
|||
} |
|||
|
|||
return JSONUtil.toBean(bean.getData().toString(), TokenDTO.class); |
|||
} |
|||
} |
|||
} |
|||
|
|||
// 获取token中的jwcode |
|||
public Integer getJwcode(String token) throws IOException { |
|||
TokenDTO dto = analysisToken(token); |
|||
return dto.getJwcode(); |
|||
} |
|||
public String getUsername(String token) throws IOException { |
|||
TokenDTO dto = analysisToken(token); |
|||
return dto.getUsername(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,41 @@ |
|||
# 配置连接池 |
|||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver |
|||
spring.datasource.url=jdbc:mysql://localhost:3306/vote_new_year?serverTimezone=UTC |
|||
spring.datasource.username=root |
|||
spring.datasource.password=123456 |
|||
# HikariCP连接池配置 |
|||
spring.datasource.hikari.maximum-pool-size=10 |
|||
spring.datasource.hikari.minimum-idle=5 |
|||
spring.datasource.hikari.idle-timeout=30000 |
|||
spring.datasource.hikari.max-lifetime=1800000 |
|||
spring.datasource.hikari.connection-timeout=30000 |
|||
spring.datasource.hikari.pool-name=HwgoldHikariCP |
|||
|
|||
# mybatis配置 |
|||
# 打印log信息 |
|||
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl |
|||
# 开启驼峰命名法,自动将数据库的命名方式,映射成Java中的命名方式 |
|||
mybatis.configuration.map-underscore-to-camel-case: true |
|||
#下面这些内容是为了让MyBatis映射 |
|||
#指定Mybatis的Mapper文件 |
|||
mybatis.mapper-locations=classpath:mappers/*xml |
|||
#指定Mybatis的实体目录 |
|||
mybatis.type-aliases-package=com.lh.mybatis.entity |
|||
|
|||
# 应用服务 WEB 访问端口 |
|||
server.port=8092 |
|||
|
|||
#Redis 配置 |
|||
spring.redis.host=localhost |
|||
spring.redis.port=26379 |
|||
spring.redis.password=123456 |
|||
spring.redis.timeout=2000 |
|||
spring.redis.jedis.pool.max-active=10 |
|||
spring.redis.jedis.pool.max-idle=5 |
|||
spring.redis.jedis.pool.min-idle=1 |
|||
|
|||
# 每日最大投票次数 |
|||
vote.limit.daily=3 |
|||
|
|||
homilychart.token.analysis.url.test = http://39.101.133.168:8828/hljw/api/v2/member/info |
|||
homilychart.token.analysis.url.prod = https://api.homilychart.com/hljw/api/v2/member/info |
@ -0,0 +1,51 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
|||
<mapper namespace="com.lh.mapper.CandidatesMapper"> |
|||
<insert id="addVotes"> |
|||
update candidates set votes = votes + 1 where jwcode = #{jwcode} |
|||
</insert> |
|||
<insert id="insertCandidate"> |
|||
insert into candidates(jwcode,name,avatar,votes,status,location,money) values(#{jwcode},#{name},#{avatar},#{votes},#{status},#{location},#{money}) |
|||
</insert> |
|||
<update id="updateCandidate"> |
|||
update candidates |
|||
<set> |
|||
<if test="name != null and name.length>0"> |
|||
name = #{name}, |
|||
</if> |
|||
<if test="avatar != null and avatar.length>0"> |
|||
avatar = #{avatar}, |
|||
</if> |
|||
<if test="votes != null"> |
|||
votes = #{votes}, |
|||
</if> |
|||
<if test="status != null"> |
|||
status = #{status}, |
|||
</if> |
|||
<if test="location != null"> |
|||
location = #{location}, |
|||
</if> |
|||
<if test="money != null"> |
|||
money = #{money}, |
|||
</if> |
|||
</set> |
|||
where jwcode = #{jwcode} |
|||
</update> |
|||
<select id="getCandidates" resultType="com.lh.bean.Candidate"> |
|||
select * from candidates order by votes desc |
|||
</select> |
|||
<select id="getByCandidateJwcode" resultType="com.lh.bean.Candidate"> |
|||
select * from candidates where jwcode = #{jwcode} |
|||
</select> |
|||
<select id="selectCandidate" resultType="com.lh.bean.Candidate"> |
|||
select * from candidates |
|||
<where> |
|||
<if test="name!=null and name.length>0"> |
|||
and name like concat('%',#{name},'%') |
|||
</if> |
|||
<if test="location!=null"> |
|||
and location = #{location} |
|||
</if> |
|||
</where> |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,20 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
|||
<mapper namespace="com.lh.mapper.VoterMapper"> |
|||
<insert id="insertVote"> |
|||
INSERT INTO voters(jwcode, candidate_jwcode, name) |
|||
VALUES(#{jwcode}, #{candidateJwcode}, #{name}) |
|||
</insert> |
|||
<select id="countVotesToday" resultType="com.lh.bean.Voter"> |
|||
SELECT * FROM voters WHERE jwcode = #{jwcode} AND DATE(vote_time) = CURDATE() |
|||
</select> |
|||
<select id="getVotesByCandidate" resultType="com.lh.bean.Voter"> |
|||
SELECT * FROM voters WHERE candidate_jwcode = #{candidateJwcode} |
|||
</select> |
|||
<select id="countVotesByCandidate" resultType="java.lang.Integer"> |
|||
SELECT COUNT(*) FROM voters WHERE candidate_jwcode = #{candidateJwcode} |
|||
</select> |
|||
<select id="getVoterByVoterAndCandidateJwcode" resultType="com.lh.bean.Voter"> |
|||
SELECT * FROM voters WHERE jwcode like concat('%',#{jwcode},'%') and candidate_jwcode = #{candidateJwcode} |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,6 @@ |
|||
<html> |
|||
<body> |
|||
<h1>hello word!!!</h1> |
|||
<p>this is a html page</p> |
|||
</body> |
|||
</html> |
@ -0,0 +1,69 @@ |
|||
package com.lh; |
|||
|
|||
import com.lh.bean.Candidate; |
|||
import com.lh.mapper.CandidatesMapper; |
|||
import com.lh.mapper.VoterMapper; |
|||
import com.lh.service.CandidatesService; |
|||
import com.lh.service.VoteService; |
|||
import org.junit.jupiter.api.Test; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
|
|||
@SpringBootTest |
|||
class VoteSystemApplicationTests { |
|||
@Autowired |
|||
private CandidatesMapper candidatesMapper; |
|||
@Autowired |
|||
private VoterMapper voterMapper; |
|||
@Autowired |
|||
private VoteService voteService; |
|||
@Autowired |
|||
private CandidatesService candidatesService; |
|||
|
|||
@Test |
|||
void contextLoads() { |
|||
candidatesMapper.getCandidates().forEach(System.out::println); |
|||
//System.out.print( voterMapper.countVotesToday("10010")); |
|||
voteService.getCandidates("90044599").forEach(System.out::println); |
|||
} |
|||
@Test |
|||
void contextLoads1() { |
|||
voterMapper.getVotesByCandidate("90044602").forEach(System.out::println); |
|||
} |
|||
@Test |
|||
void contextLoads2() { |
|||
voterMapper.insertVote("10010","20010","王五"); |
|||
} |
|||
@Test |
|||
void contextLoads3() { |
|||
// candidatesMapper.insertCandidate(new Candidate(null,"A001","口红","1.jpg",0,0,100,1,"王五","王五","王五",false)); |
|||
// candidatesMapper.updateCandidate(new Candidate(null,"A001","口红",null,null,null,null,null,null,null,null,false)) |
|||
// System.out.print(voterMapper.countVotesByCandidate("A001")); |
|||
candidatesMapper.selectCandidate(new Candidate(null,"A001",null,null,null,null,0,null,null,null,null,false)).forEach(System.out::println); |
|||
} |
|||
@Test |
|||
void contextLoads4(){ |
|||
candidatesService.insertCandidate(new Candidate(null,"011","iphone","1.jpg",0,1,2,1000,"王五","王五","王五",false)); |
|||
} |
|||
|
|||
@Test |
|||
void contextLoads5(){ |
|||
System.out.print(candidatesService.changeCandidateStatus("011")); |
|||
} |
|||
@Test |
|||
void contextLoads6(){ |
|||
System.out.print(candidatesService.updateCandidate(new Candidate(null,"011","iphone16","1.jpg",0,null,null,null,null,null,null,false))); |
|||
} |
|||
@Test |
|||
void contextLoads7(){ |
|||
System.out.print(candidatesService.updateCandidate(new Candidate(null,"011","iphone18","1.jpg",0,null,null,null,null,null,null,false))); |
|||
} |
|||
@Test |
|||
void contextLoads8(){ |
|||
// candidatesService.selectCandidate(new Candidate(null,null,null,null,null,null,2,null,null,null,null,false)).forEach(System.out::println); |
|||
} |
|||
@Test |
|||
void contextLoads9(){ |
|||
candidatesService.getVoterByCandidateAndVoterJwcode("90044599","010").forEach(System.out::println); |
|||
} |
|||
} |