bug 修改

sale
tianea 3 years ago
parent 5c86fdc0b8
commit 544327319a

@ -14,6 +14,14 @@ export function listQuestion(compId,stageId){
params: { compId: compId,stageId: stageId}
})
}
export function listQuestion2(compId,stageId){
return request({
url: authUrl+'exam/list2',
method: 'get',
params: { compId: compId,stageId: stageId}
})
}
export function submit(compId,stageId,qList){
return request({
url: authUrl+ "exam/submit",

@ -24,7 +24,7 @@ export function getMemberInfo(compId,stageId){
export function getPaper(compId,stageId){
return request({
url: authUrl+"paper",
url: authUrl+"/paper",
method: 'get',
params: {
compId: compId,

@ -2,7 +2,7 @@ import request from '@/utils/request'
let baseUrl = "auth/competition/task"
export function list(compId){
return request({
url: authUrl+"list",
url: baseUrl+"/list",
method: 'get',
params: {
compId: compId
@ -12,7 +12,7 @@ export function list(compId){
export function get(compId,stageId){
return request({
url: authUrl+"list",
url: baseUrl+"/get",
method: 'get',
params: {
compId: compId,

@ -253,9 +253,9 @@ export default {
listDone(){
competitionApi.getList(this.page2.pageNo,this.page2.type).then(res=>{
if(res.code == 200){
for(var i= 0;i<res.data.list.length;i+=3) {
let index = i/3
this.list2[index] = res.data.list.slice(i,i+3)
for(var i= 0;i<res.data.list.length;i+=2) {
let index = i/2
this.list2[index] = res.data.list.slice(i,i+2)
}
}
})

@ -4,6 +4,7 @@ import Index from '@/components/index'
import CompetitionIndex from '@/views/competition/index'
import Login from '@/views/login/index'
import Exam from '@/views/system/exam'
import ExamResult from '@/views/system/examresult'
import Member from '@/views/member/index'
import System from '@/views/system/index'
import {getInfo} from '@/utils/auth'
@ -33,6 +34,11 @@ let router = new Router({
name: 'Exam',
component: Exam
},
{
path: '/examrs',
name: 'ExamResult',
component: ExamResult
},
{
path: '/member',
name: 'Member',

@ -49,10 +49,10 @@
<div @click="gotPage(1,item.id)">></div>
</div>
<div>
<b-img fluid src="/static/image/img1_580x260.jpg"/>
<b-img fluid :src="getThumbnail(item.id,1)"/>
</div>
<div class="stage-time">
竞赛时间:<span>2022-04-03 18:00</span>--<span>2022-05-06 18:00</span>
竞赛时间:<span>{{getStartTime(item.id,1)}}</span>--<span>{{getEndTime(item.id,1)}}</span>
</div>
</div>
<div class="stage-box">
@ -61,10 +61,10 @@
<div @click="gotPage(2,item.id)">></div>
</div>
<div>
<b-img fluid src="/static/image/img4_580x260.jpg"/>
<b-img fluid :src="getThumbnail(item.id,2)"/>
</div>
<div class="stage-time">
竞赛时间:<span>2022-04-03 18:00</span>--<span>2022-05-06 18:00</span>
竞赛时间:<span>{{getStartTime(item.id,3)}}</span>--<span>{{getEndTime(item.id,1)}}</span>
</div>
</div>
</div>
@ -72,10 +72,12 @@
</div>
</template>
<script>
import * as taskApi from '@/api/task'
export default {
data(){
return {
compId: 0,
taskList: []
}
},
props:{
@ -87,6 +89,11 @@ export default {
created(){
if(this.$route.query){
this.compId = this.$route.query.id
taskApi.list(this.compId).then(res=>{
if(res.code == 200){
this.taskList = res.data.list
}
})
}
},
methods:{
@ -102,6 +109,45 @@ export default {
query: { id: this.compId,stageId: id}
})
}
},
getThumbnail(stageId,type){
let stage = this.getStage(stageId)
if(stage){
if(type == 1){
return stage.examLogo
}else{
return stage.operationLogo
}
}
return '/static/image/img1_580x260.jpg';
},
getStartTime(stageId,type){
let stage = this.getStage(stageId)
if(stage){
if(type == 1){
return new Date(stage.examStartTime).Format('yyyy-MM-dd hh:mm:ss')
}else{
return new Date(stage.operationStartTime).Format('yyyy-MM-dd hh:mm:ss')
}
}
return '';
},
getEndTime(stageId,type){
let stage = this.getStage(stageId)
if(stage){
if(type == 1){
return new Date(stage.examEndTime).Format('yyyy-MM-dd hh:mm:ss')
}else{
return new Date(stage.operationEndTime).Format('yyyy-MM-dd hh:mm:ss')
}
}
return '';
},
getStage(stageId){
let rs = this.taskList.filter(task=> task.stageId == stageId)
if(!!rs&&rs.length>0){
return rs[0]
}
}
}

@ -50,7 +50,7 @@
<div>
<b-img src="/static/image/icon4_105x105.png" />
<div>个人总资产</div>
<div class="tz-font tz-font-purple">{{memberInfo.totalFounds}}</div>
<div class="tz-font tz-font-purple">{{memberInfo.totalFounds/10000}}</div>
</div>
</b-col>
</b-row>
@ -304,8 +304,8 @@ export default {
title = '团队收益率';
}
let date = [];
let data = [Math.random() * 300];
let data2 = [Math.random() * 300]
let data = [];
let data2 = []
for (let i = 0; i < rankList.length; i++) {
let tmp = rankList[i]
var now = new Date(tmp.updateTime);

@ -203,7 +203,8 @@ export default {
doneList:[],
markList:[],
current: 1,
}
},
memberInfo: null
}
},
methods:{
@ -369,6 +370,7 @@ export default {
this.loadQuestion()
}else{
alert(res.msg)
}
})
},
@ -419,6 +421,20 @@ export default {
this.competition = res.data
}
})
memberApi.getMemberInfo(this.compId,this.stageId).then(res=>{
if(res.code == 200){
this.memberInfo = res.data
if(!!this.memberInfo.examScore&&this.memberInfo.examScore>=0){
this.$router.push({
path: '/examrs',
query: {
id: this.compId,
stageId: this.stageId
}
})
}
}
})
}
this.userInfo = getInfo()
// this.loadQuestion()

@ -14,7 +14,7 @@
<span><b-img src="/static/image/system_icon2.png" /></span>
<span>仿真交易</span>
</div>
<div @click=" tabId = 2" :class="tabId == 2 ?'tz-selected':''">
<div @click=" changeTab(2)" :class="tabId == 2 ?'tz-selected':''">
<span><b-img src="/static/image/system_icon3.png" /></span>
<span>排行榜</span>
</div>
@ -78,7 +78,7 @@
<div class="tz-tab">
<div>
<b-img @click="sim" src="/static/image/trade_sim.png" />
<b-img @click=" tabId = 2" src="/static/image/ranking_tab.png" />
<b-img @click=" changeTab(2)" src="/static/image/ranking_tab.png" />
<b-img @click="jixiao" src="/static/image/jixiaofenxi.png" />
<b-img @click=" tabId = 4" src="/static/image/xingweihuaxiang.png" />
</div>
@ -116,16 +116,16 @@
<div class="tz-filter">
<div>
<span>日期</span>
<b-datepicker placeholder="" />
<b-datepicker v-model="rankQuery.date" />
<span> 检索</span>
<b-input placeholder="用户名/所属院校/所属团队" />
<b-button class="tz-button">查询</b-button>
<b-input v-model="rankQuery.keyword" placeholder="用户名/所属院校/所属团队" />
<b-button class="tz-button" @click="rankSearch"></b-button>
<b-button class="tz-button">导出</b-button>
</div>
<div class="online-info">
<!-- <div class="online-info">
<span>注册人数1090</span>
<span>在线人数 687</span>
</div>
</div> -->
</div>
<div>
<div class="tz-table-header">
@ -138,56 +138,56 @@
<div>
属属团队
</div>
<div class="tz-tabel-bg-blue">
<div class="tz-tabel-bg-blue" @click="rankSort('score')">
操作分
<div class="tz-inline-block">
<div class="triangle_up"></div>
<div class="triangle_down"></div>
</div>
</div>
<div>
<div @click="rankSort('rank')" >
排名
<div class="tz-inline-block">
<div class="triangle_up"></div>
<div class="triangle_down"></div>
</div>
</div>
<div>
<div @click="rankSort('found')">
期初资金
<div class="tz-inline-block">
<div class="triangle_up"></div>
<div class="triangle_down"></div>
</div>
</div>
<div>
<div @click="rankSort('nav')">
总资产
<div class="tz-inline-block">
<div class="triangle_up"></div>
<div class="triangle_down"></div>
</div>
</div>
<div>
<div @click="rankSort('avilable')">
可用资金
<div class="tz-inline-block">
<div class="triangle_up"></div>
<div class="triangle_down"></div>
</div>
</div>
<div class="tz-tabel-bg-blue">
<div class="tz-tabel-bg-blue" @click="rankSort('market')">
市值
<div class="tz-inline-block">
<div class="triangle_up"></div>
<div class="triangle_down"></div>
</div>
</div>
<div>
<div @click="rankSort('profit')">
累计盈亏
<div class="tz-inline-block">
<div class="triangle_up"></div>
<div class="triangle_down"></div>
</div>
</div>
<div class="tz-tabel-bg-blue">
<div class="tz-tabel-bg-blue" @click="rankSort('score')">
浮动盈亏
<div class="tz-inline-block">
<div class="triangle_up"></div>
@ -271,24 +271,24 @@
<div>{{ item.name}}</div>
<div class="tz-table-color-blue">{{ item.school}}</div>
<div>{{ item.team}}</div>
<div class="tz-table-color-blue">{{ item.score}}</div>
<div>{{ item.ranking}}</div>
<div class="tz-table-color-blue">{{ numberFixed(item.financeScore)}}</div>
<div>{{ item.personalRank}}</div>
<div>{{ item.founds}}</div>
<div>{{ item.nav}}</div>
<div>{{ item.avilable}}</div>
<div class="tz-table-color-blue">{{ item.marketValue}}</div>
<div>{{ item.totalRatio}}</div>
<div class="tz-table-color-blue">{{ item.overRatio}}</div>
<div>{{ item.commsion}}</div>
<div class="tz-table-color-blue">{{ item.sumRatio}}</div>
<div>{{ item.baseRatio}}</div>
<div>{{ item.yearRatio}}</div>
<div>{{ item.maxReturn}}</div>
<div>{{ item.kammaRatio}}</div>
<div>{{ item.sharpRatio}}</div>
<div>{{ numberFixed(item.nav)}}</div>
<div>{{ numberFixed(item.available)}}</div>
<div class="tz-table-color-blue">{{ numberFixed(item.marketValue)}}</div>
<div>{{ numberFixed(item.profitLoss)}}</div>
<div class="tz-table-color-blue">{{ numberFixed(item.fpnl)}}</div>
<div>{{ numberFixed(item.cumCommission)}}</div>
<div class="tz-table-color-blue">{{ numberFixed(item.pnlRatio)}}</div>
<div>{{ numberFixed(item.baseRatio)}}</div>
<div>{{ numberFixed(item.pnlRatioAnnual)}}</div>
<div>{{ numberFixed(item.maxDrawdown)}}</div>
<div>{{ numberFixed(item.calmarRatio)}}</div>
<div>{{ numberFixed(item.sharpRatio)}}</div>
<div>{{ item.openCount}}</div>
<div>{{ item.closeCount}}</div>
<div>{{ item.winRatio}}</div>
<div>{{ numberFixed(item.winRatio)}}</div>
</div>
</div>
</div>
@ -311,7 +311,7 @@
</div>
</div>
<div v-if="tabId == 4">
<tz-portrait />
<tz-portrait :competition="competition" :currentStage="currentStage" :memberInfo="memberInfo" :compId="compId" :stageId="stageId" />
</div>
<div v-if="tabId == 5">
@ -328,6 +328,7 @@ import * as echarts from 'echarts'
import { getInfo } from '@/utils/auth'
import * as competitionApi from '@/api/competition'
import * as memberApi from '@/api/member'
import * as rankingApi from '@/api/ranking'
export default {
components:{
'tz-footer': Footer,
@ -353,6 +354,19 @@ export default {
},
changeTab(id){
this.tabId = id
console.log(this.tabId )
if(id==2){
this.loadRankinig2()
}
},
numberFixed(num){
if(typeof(num) == 'number'){
return num.toFixed(4)
}
return num
},
rankSearch(){
this.loadRankinig2()
},
loadData(){
memberApi.getMemberInfo(this.compId, this.stageId).then(res=>{
@ -361,18 +375,46 @@ export default {
}
})
},
drawRanking(){
loadRankinig2(){
this.rankQuery.compId = this.compId
this.rankQuery.stageId = this.stageId
rankingApi.list(this.rankQuery).then(res=>{
if(res.code == 200 ){
this.list = res.data.list
}
})
},
rankSort(key){
},
loadRankinig(){
rankingApi.listAll(this.compId,this.stageId).then(res=>{
if(res.code == 200){
this.drawRanking(res.data.list)
}
})
},
drawRanking(rankList){
let xData = []
let yData = []
rankList.forEach(item=>{
xData.push(item.updateTime)
yData.push(item.personalRank)
})
let option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data: xData
},
yAxis: {
type: 'value'
},
series: [
{
data: [150, 230, 224, 218, 135, 147, 260],
data: yData,
type: 'line',
color:['#7c89ff']
}
@ -400,7 +442,16 @@ export default {
compId: 0 ,
stageId: 0,
currentStage: null,
memberInfo: null
memberInfo: null,
rankQuery:{
pageNo: 1,
date: '',
keyword: '',
sort: '',
direct: 1,
compId: 0,
stageId: 0
}
}
},
created(){
@ -423,37 +474,11 @@ export default {
console.log("groupData:",res)
})
}
for(var i = 0 ;i<50;i++){
this.list.push({
name: '王先生',
school: '天择金融大学',
team: '王老师团队',
score: 98,
ranking: (i+1),
founds: 1000000,
nav: 100000000,
avilable: 5000.00,
marketValue: 10000000000,
totalRatio: '10%',
overRatio: '90%',
commsion: 10000,
sumRatio: '150%',
baseRatio: '10%',
yearRatio: '12%',
maxReturn: 10,
kammaRatio: '10:5',
sharpRatio: '10:6',
openCount: 50,
closeCount: 10,
winRatio: '5%'
})
}
},
updated(){
if(this.tabId == 0 ){
this.$nextTick(()=>{
this.drawRanking()
this.loadRankinig()
})
}
}

@ -1,7 +1,7 @@
<template>
<div>
<div class="comp-info">
<div class="tz-bold"> >>2020年全国高职财经大数据分析大赛--初赛--证券投资赛项 </div>
<div class="tz-bold"> >>{{ competition.name }}--{{ currentStage.name }}--证券投资赛项 </div>
<div class="member-info">
<div>
<b-img src="/static/image/system_icon11.png"/>
@ -133,7 +133,30 @@
<script>
import * as echarts from 'echarts';
import { getInfo } from '@/utils/auth'
import * as rankApi from '@/api/ranking'
export default {
props:{
compId:{
type: Number,
default: 0
},
stageId:{
type: Number,
default: 0
},
competition:{
type: Object,
default: null
},
currentStage:{
type:Object,
default: null
},
memberInfo:{
type:Object,
default: null
}
},
data(){
return {
userInfo: null,
@ -213,36 +236,50 @@ export default {
this.positionCharts.setOption(positionOption,true)
},
drawProfit(){
let option = {
xAxis: {
type: 'category',
boundaryGap: false,
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [
{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'line',
areaStyle: {
color: "#daf7f0"
},
},
{
data: [400, 432, 401, 534, 1090, 1030, 1020],
type: 'line',
areaStyle: {
color: "#daf7f0"
},
rankApi.listWeek(this.compId,this.stageId).then(res=>{
if(res.code == 200){
let xData = []
let yData = []
let yData2= []
for(let i = 0;i<res.data.list.length;i++){
let item = res.data.list[i]
xData.push(item.updateTime)
yData.push(item.baseRatio)
yData2.push(item.pnlRatio)
}
]
}
if(!this.profitCharts){
this.profitCharts = echarts.init(document.getElementById('profit'))
}
this.profitCharts.setOption(option)
let option = {
xAxis: {
type: 'category',
boundaryGap: false,
data: xData
},
yAxis: {
type: 'value'
},
series: [
{
data: yData,
type: 'line',
areaStyle: {
color: "#daf7f0"
},
},
{
data: yData2,
type: 'line',
areaStyle: {
color: "#daf7f0"
},
}
]
}
if(!this.profitCharts){
this.profitCharts = echarts.init(document.getElementById('profit'))
}
this.profitCharts.setOption(option)
}
})
},
drawHeavy(){
@ -261,8 +298,8 @@ export default {
type: 'pie',
radius: '50%',
data: [
{ value: 1048, name: '当前仓位' },
{ value: 735, name: '可用资金'}
{ value: this.memberInfo.totalFounds, name: '当前仓位' },
{ value: this.memberInfo.availableFounds, name: '可用资金'}
],
emphasis: {
itemStyle: {

@ -18,12 +18,22 @@ public class ApiCompetitionRankingController extends BaseController {
private ApiRankingBiz rankingBiz;
@GetMapping(value = "list")
public Result<ListRankingDTO> listRank(@RequestParam("compId") Long cmpId, @RequestParam("stageId") Integer stageId,@RequestParam("orderBy") String sort,@RequestParam("direct") Integer direct,String date){
return rankingBiz.list(cmpId,stageId,sort,direct,date);
public Result<ListRankingDTO> listRank(@RequestParam("pageNo") Integer pageNo,@RequestParam("compId") Long cmpId, @RequestParam("stageId") Integer stageId,@RequestParam("sort") String sort,@RequestParam("direct") Integer direct,@RequestParam("date") String date,@RequestParam("keyword") String keyword){
return rankingBiz.list(cmpId,stageId,sort,direct,date,keyword);
}
@GetMapping(value = "listAll")
public Result<ListRankingDTO> listAll(@RequestParam("compId") Long cmpId, @RequestParam("stageId") Integer stageId){
return rankingBiz.listAll(cmpId,stageId,getUserNo());
}
@GetMapping(value = "listWeek")
public Result<ListRankingDTO> listWeek(@RequestParam("compId") Long cmpId, @RequestParam("stageId") Integer stageId){
return rankingBiz.listWeek(cmpId,stageId,getUserNo());
}
@GetMapping(value = "memberRank")
public Result<ListRankingDTO> listMemberRank(@RequestParam("pageNo") Integer pageNo,@RequestParam("compId") Long cmpId, @RequestParam("stageId") Integer stageId,@RequestParam("sort") String sort,@RequestParam("direct") Integer direct,@RequestParam("keyword") String keyword){
return rankingBiz.listMemberRank();
}
}

@ -6,22 +6,24 @@ import com.tz.platform.competitiion.api.dto.CompetitionTaskDTO;
import com.tz.platform.competitiion.api.dto.ListCompetitionTaskDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@Controller
@RequestMapping(value = "auth/competition/task")
@RestController
@RequestMapping(value = "/auth/competition/task")
public class ApiCompetitionTaskController {
@Autowired
private CompetitionTaskBiz taskBiz;
@RequestMapping(value = "list")
@GetMapping(value = "list")
public Result<ListCompetitionTaskDTO> list(@RequestParam("compId") Long compId){
return taskBiz.list(compId);
}
@RequestMapping(value = "get")
@GetMapping(value = "get")
public Result<CompetitionTaskDTO> get(@RequestParam("compId") Long compId, @RequestParam("stageId") Integer stageId){
return taskBiz.get(compId,stageId);
}

@ -24,7 +24,12 @@ public class CompetitionExamController extends BaseController {
@GetMapping(value = "list")
public List<QuestionVo> getQusetion(@RequestParam("compId") Long compId, @RequestParam("stageId") Integer stageId ){
return examBiz.getExamQuestion(compId,stageId,getUserNo());
return examBiz.getExamQuestion(compId,stageId,getUserNo(),0);
}
@GetMapping(value = "list2")
public List<QuestionVo> getQusetion2(@RequestParam("compId") Long compId, @RequestParam("stageId") Integer stageId ){
return examBiz.getExamQuestion(compId,stageId,getUserNo(),1);
}
@PostMapping(value = "submit")

@ -43,6 +43,11 @@ public class CompetitionIndexControll extends BaseController {
return competitionIndexBiz.listRanKing(pageNo,pageSize,date,key,compId,stageId);
}
@GetMapping(value = "ranking")
public Result<ListRankingDTO> MemberRanking(@RequestParam("pageNO") Integer pageNo,@RequestParam("pageSize") Integer pageSize,@RequestParam("key") String key,@RequestParam("compId") Long compId, @RequestParam("stageId")Integer stageId){
return Result.error("");
}
@GetMapping(value = "group")
public Result<ListGroupDTO> getGroup(@RequestParam("compId") Long compId,@RequestParam("stageId") Integer stageId){
return competitionIndexBiz.getGroup(compId);

@ -5,8 +5,10 @@ import com.tz.platform.common.core.tools.BeanUtils;
import com.tz.platform.competitiion.api.dto.ListRankingDTO;
import com.tz.platform.competitiion.api.dto.RankingDTO;
import com.tz.platform.entity.Competition;
import com.tz.platform.entity.CompetitionMember;
import com.tz.platform.entity.Ranking;
import com.tz.platform.repository.CompetitionDao;
import com.tz.platform.repository.CompetitionMemberDao;
import com.tz.platform.repository.RankingDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
@ -16,6 +18,7 @@ import org.springframework.util.StringUtils;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Component
public class ApiRankingBiz
@ -30,7 +33,10 @@ public class ApiRankingBiz
@Autowired
private RankingDao rankingDao;
public Result<ListRankingDTO> list(Long compId,Integer stageId,String sort,Integer direct,String date){
@Autowired
private CompetitionMemberDao memberDao;
public Result<ListRankingDTO> list(Long compId,Integer stageId,String sort,Integer direct,String date,String keyword){
Competition competition = competitionDao.getById(compId);
@ -51,6 +57,23 @@ public class ApiRankingBiz
rankingList = (List<Ranking>) rankList;
}
if(StringUtils.hasText(keyword)){
rankingList = rankingList.stream().filter(ranking -> {
boolean rs = false;
if(ranking.getName()!= null&&ranking.getName().contains(keyword)){
rs = true;
}
if(ranking.getSchool()!=null&&ranking.getSchool().contains(keyword)){
rs = true;
}
if(ranking.getTeamName()!=null&&ranking.getTeamName().contains(keyword)){
rs = true;
}
return rs;
}).collect(Collectors.toList());
}
Collections.sort(rankingList, (o1, o2) -> {
if(StringUtils.isEmpty(sort)){
Integer r1 = o1.getPersonalRank();
@ -96,4 +119,32 @@ public class ApiRankingBiz
dto.setList(rankingDTOList);
return Result.success(dto);
}
public Result<ListRankingDTO> listWeek(Long compId,Integer stageId,Long userNo){
String key = "rankList_"+compId+"_"+stageId+"_"+userNo;
Object rankList = template.opsForValue().get(key);
List<Ranking> rankingList = null;
if(rankList == null){
rankingList = rankingDao.findAllByCompIdAndStageIdAndUserNo(compId,stageId,userNo);
if(rankingList!=null&&rankingList.size()>0){
template.opsForValue().set(key,rankingList,30, TimeUnit.MINUTES);
}
}else{
rankingList = (List<Ranking>) rankList;
}
ListRankingDTO dto = new ListRankingDTO();
if(rankingList.size()>7){
rankingList = rankingList.subList(rankingList.size()-7,rankingList.size()-1);
}
List<RankingDTO> rankingDTOList = BeanUtils.copyProperties(rankingList,RankingDTO.class);
dto.setTotal(rankingDTOList.size());
dto.setList(rankingDTOList);
return Result.success(dto);
}
public Result<ListRankingDTO> listMemberRank(){
return Result.error("失败");
}
}

@ -53,7 +53,7 @@ public class CompetitionExamBiz {
@Autowired
private RedisTemplate<String,Object> template;
public List<QuestionVo> getExamQuestion(Long compId,Integer stageId,Long userId){
public List<QuestionVo> getExamQuestion(Long compId,Integer stageId,Long userId,Integer type ){
UserVo currentUser = feignUser.getByUserNo(userId);
String key = "questionList_"+compId+"_"+stageId+"_"+currentUser.getLevelId();
Object questListObj = template.opsForValue().get(key);
@ -84,16 +84,18 @@ public class CompetitionExamBiz {
qo.setIds(ids);
questionVos = feignExam.listQusetion(qo);
}
if(type == 0){
questionVos.forEach(questionVo -> {
if(questionVo.getType() == 0){
questionVo.setAnswerId(new ArrayList<>());
}else{
questionVo.getChildren().forEach(child->{
child.setAnswerId(new ArrayList<>());
});
}
});
}
questionVos.forEach(questionVo -> {
if(questionVo.getType() == 0){
questionVo.setAnswerId(new ArrayList<>());
}else{
questionVo.getChildren().forEach(child->{
child.setAnswerId(new ArrayList<>());
});
}
});
return questionVos;
}
@ -153,7 +155,7 @@ public class CompetitionExamBiz {
}
SubmitResultDTO dto = new SubmitResultDTO();
List<QuestionVo> questionVoList = getExamQuestion(vo.getCompId(),vo.getStageId(),vo.getUserNo());
List<QuestionVo> questionVoList = getExamQuestion(vo.getCompId(),vo.getStageId(),vo.getUserNo(),1);
Double score = computeScore(questionVoList,vo.getQList());
competitionMemberDao.updateScore(vo.getUserNo(),vo.getStageId(),vo.getCompId(),score);
competitionMemberDao.updateExamEndTimeAndCostTime(vo.getUserNo(),vo.getStageId(),vo.getCompId(),now,costTime);

@ -55,10 +55,10 @@ public class CompetitionJob {
}
/**
* 2
*
*/
// @Scheduled(cron = "0 0 2 1 * ?")
@Scheduled(cron = "5 * * * * ?")
@Scheduled(cron = "*/60 * * * * ?")
// @Scheduled(cron = "5 * * * * ?")
public void fetchRanking(){
String jobName = "rankingJob";
boolean lock = lock(jobName,ms);

@ -101,6 +101,7 @@ public class RankingBiz {
member.setHighestRatio(maxRatio);
}
Ranking ranking = new Ranking();
ranking.setInitFounds(member.getInitFounds());
ranking.setUserNo(member.getUserId());
ranking.setCompId(competition.getId());
ranking.setName(member.getName());
@ -206,7 +207,7 @@ public class RankingBiz {
Map<Integer,List<Ranking>> map = rankingList.stream().collect(Collectors.groupingBy(Ranking::getTeamId));
map.forEach((k,v)->{
Double teamRatio = v.stream().mapToDouble((r)-> {
Double t = r.getProfitLoss();
Double t = r.getPnlRatio();
if(t == null){
return 0D;
}

@ -16,7 +16,6 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Date;
@ -33,8 +32,29 @@ public class PCCompetitionBiz {
if(vo.getType() == null||vo.getType()<=0){
return Result.error("大赛类型不能为空");
}
Competition competition = new Competition();
BeanUtils.copyProperties(vo,competition);
Competition competition = null;
if(vo.getId() == null){
competition = new Competition();
BeanUtils.copyProperties(vo,competition);
competition.setStatus(-1);
}else{
competition = competitionDao.getById(vo.getId());
competition.setName(vo.getName());
competition.setSponsor(vo.getSponsor());
competition.setSupporter(vo.getSupporter());
competition.setTeamMinCount(vo.getTeamMinCount());
competition.setTeamMaxCount(vo.getTeamMaxCount());
competition.setStageList(vo.getStageList());
competition.setBannerList(vo.getBannerList());
competition.setThumbnail(vo.getThumbnail());
competition.setSummary(vo.getSummary());
competition.setRule(vo.getRule());
competition.setPrize(vo.getPrize());
competition.setNews(vo.getNews());
competition.setSchoolNews(vo.getSchoolNews());
}
Date startTime=competition.getStageList().get(0).getStartTime();
Date endTime =competition.getStageList().get(competition.getStageList().size()-1).getEndTime();
Stage signupStage = competition.getStageList().stream().filter(stage -> stage.isEnableSignUp()).findFirst().orElse(null);
@ -59,16 +79,27 @@ public class PCCompetitionBiz {
competition.setEnableSignup(false);
}
competition.setStartTime(startTime);
competition.setEndTime(endTime);
competition.setSignupStartTime(signUpStartTime);
competition.setSignupEndTime(signupEndTime);
competition.setStatus(-1);
if(competition.getId() == null){
competition.setCreateTime(new Date());
}
competition.getNews().forEach(competitionNews -> {
if(competitionNews.getCreateTime() == null){
competitionNews.setCreateTime(System.currentTimeMillis());
}
});
competition.getSchoolNews().forEach(competitionNews -> {
if(competitionNews.getCreateTime() == null){
competitionNews.setCreateTime(System.currentTimeMillis());
}
} );
competition =competitionDao.save(competition);
return Result.success(competition.getId());
}

@ -113,6 +113,8 @@ public class TeamBiz {
member.setTeacher(team.getTeacherName());
member.setTeamName(team.getTeamName());
member.setLevelId(m.getLevelId());
member.setProvinceId(m.getProvinceId());
member.setRegionId(m.getRegionId());
memberList.add(member);
});
@ -151,7 +153,7 @@ public class TeamBiz {
@Transactional
public Result<String> addTeam(AddTeamVO vo){
CompetitionTeam teamT = teamDao.getByTeamName(vo.getTeamName());
CompetitionTeam teamT = teamDao.getByTeamNameAndCompetitionIdAndStageId(vo.getTeamName(),vo.getCompetitionId(),vo.getStageId());
if(teamT !=null){
return Result.error("团队名称已存在");
}

@ -117,6 +117,8 @@ public class TeamTemplateImportBiz {
member.setTeamName(teamInfo.getTeamName());
member.setLevelId(info.getLevelId());
member.setTeacher(team.getTeacher());
member.setProvinceId(member.getProvinceId());
member.setRegionId(member.getRegionId());
memberList.add(member);
}
});
@ -195,6 +197,8 @@ public class TeamTemplateImportBiz {
member.setTeamName("个人赛");
member.setLevelId(info.getLevelId());
member.setTeacher(m.getTeacher());
member.setProvinceId(info.getProvinceId());
member.setRegionId(info.getRegionId());
memberList.add(member);
});
memberDao.saveAll(memberList);

@ -22,6 +22,7 @@ public class CompetitionVO implements Serializable {
private List<Rotation> bannerList;
private String thumbnail;
private String summary;
private Integer status;
private String rule;
private String prize;
private List<CompetitionNews> news;

@ -38,6 +38,8 @@ public class CompetitionMember {
private Date examEndTime;
private Double examCostTime;
private Integer levelId;
private Integer provinceId;
private Integer regionId;
@Column(columnDefinition = "double(11,3) default '0.00'")
private Double initFounds;
@Column(columnDefinition = "double(11,3) default '0.00'")

@ -15,6 +15,11 @@ public class Ranking {
private String accountId;
/**
*
*/
private Double initFounds;
/**
*
*/

@ -206,9 +206,9 @@ public class JueJinApi {
// api.deleteAccount("4811913f-9dba-11ec-89b3-00163e0e6ad0");
// api.getCashInfo("2e41a913-9dc1-11ec-89b3-00163e0e6ad0");
// api.test();
api.createReport(accountId,"report"+ System.currentTimeMillis());
// api.createReport(accountId,"report"+ System.currentTimeMillis());
// api.getCashInfo(accountId);
api.getReport("14892159");
api.getReport("16898647");
// api.getStockInfo("SHSE.600547,SHSE.603160");
// api.getProfit("2022-03-11","2022-03-15");
// api.getHeavy(accountId,start,end);

@ -9,6 +9,7 @@ import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@ -54,10 +55,12 @@ public interface CompetitionMemberDao extends JpaRepository<CompetitionMember,In
int updateHighestRatio(@Param("userNo") Long userNo,@Param("stageId") Integer stageId,@Param("compId") Long comId, @Param("ratio") Double ratio);
@Transactional
@Modifying
@Query(value = "update competition_member set personal_rank=:rank where user_id=:userNo and stage_id=:stageId and competition_id=:compId",nativeQuery = true)
int updatePersonalRank(@Param("userNo") Long userNo,@Param("stageId") Integer stageId,@Param("compId") Long comId, @Param("rank") Integer rank);
@Transactional
@Modifying
@Query(value = "update competition_member set team_rank=:rank where user_id=:userNo and stage_id=:stageId and competition_id=:compId",nativeQuery = true)
int updateTeamRank(@Param("userNo") Long userNo,@Param("stageId") Integer stageId,@Param("compId") Long comId, @Param("rank") Integer rank);

@ -4,9 +4,13 @@ import com.tz.platform.entity.CompetitionTeam;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CompetitionTeamDao extends JpaRepository<CompetitionTeam,Integer> {
CompetitionTeam getById(Integer id);
CompetitionTeam getByTeamName(String teamName);
CompetitionTeam getByTeamNameAndCompetitionIdAndStageId(String teamName,Long compId,Integer stageId);
List<CompetitionTeam> findAllByTeamName(String teamName);
int countByCompetitionId(Long competitionId);
}

@ -10,7 +10,7 @@ spring:
active: dev
cloud:
nacos:
server-addr: 172.19.255.105:8848
server-addr: 127.0.0.1:8848
username: nacos
password: nacos
config:

@ -15,6 +15,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Component
@ -77,7 +78,12 @@ public class PCMuiltQuestionBiz {
subQuestionVO.setId(Long.valueOf (i+1));
score+=subQuestionVO.getScore();
}
question.setScore(score);
question.setCreatorId(vo.getUserNo());
question.setCreateTime(new Date());
question.setStatus(1);
question.setType(1);
question = questionDao.save(question);
return Result.success(question.getId());
}

@ -11,9 +11,9 @@ public class MuiltQuestionVO {
private Long id;
private Long courseId;
private String courseName;
private Long levelId;
private Integer levelId;
private String levelName;
private Long questionType;
private Integer questionType;
private Long score;
private Integer type;
private String stem;

@ -11,9 +11,9 @@ public class QuestionVO {
private Long id;
private Long courseId;
private String courseName;
private Long levelId;
private Integer levelId;
private String levelName;
private Long questionType;
private Integer questionType;
private String title;
private Long score;
private Integer type;

@ -7,7 +7,7 @@ spring:
active: dev
cloud:
nacos:
server-addr: 127.0.0.1:8848
server-addr: 172.19.255.105:8848
username: nacos
password: nacos
config:

@ -27,7 +27,8 @@ public class PCImageBiz {
System.out.println(UserNo);
String fileName = System.currentTimeMillis()+"";
try {
Thumbnails.of(multipartFile.getResource().getInputStream()).size(w,h).outputFormat("png").toFile(SystemUtil.PIC_PATH+fileName);
String debugPath = "/Volumes/Lexar/www/pic/";
Thumbnails.of(multipartFile.getResource().getInputStream()).size(w,h).outputFormat("png").toFile(debugPath+fileName);
} catch (IOException e) {
e.printStackTrace();
return Result.error("上传失败");

@ -5,7 +5,11 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@ -46,4 +50,9 @@ public interface UserDao extends JpaRepository<User,Long> , JpaSpecificationExec
List<User> findAllByIdIn(List<Long> ids);
Page<User> findAllByUsernameOrName(String username,String name,Pageable pageable);
@Transactional
@Modifying
@Query(value = "update user set mobile_salt=:salt,mobile_psw=:pwd where id=:id",nativeQuery = true)
int updatePassword(@Param("id") Long id,@Param("salt") String salt,@Param("pwd") String pwd );
}

@ -37,6 +37,11 @@ public class PcUserInfoController extends BaseController {
return pcUserInfoBiz.listByStudentNoOrSchool(bo);
}
@PostMapping(value = "initPwd")
public Result<String> initPassword(@RequestBody UserVO vo){
return pcUserInfoBiz.initPassword(vo);
}
@PostMapping(value = "deleteUser")
public Result<String> deletUser(@RequestBody UserVO vo){
return pcUserInfoBiz.deleteUser(vo);

@ -187,6 +187,18 @@ public class PcUserInfoBiz {
return Result.success("成功");
}
public Result<String> initPassword(UserVO vo){
User user = userDao.getById(vo.getUserNo());
if(user.getUserType()!= UserTypeEnum.ADMIN.getCode()){
return Result.error("无操作权限");
}
String salt =StrUtil.get32UUID();
String pwd = DigestUtil.sha1Hex(salt+ SystemUtil.INIT_PASSWORD);
userDao.updatePassword(vo.getId(),salt,pwd);
return Result.success("success");
}
public Result<Long> saveAdmin(UserVO vo){
if(StringUtils.isEmpty(vo.getName())){

@ -7,7 +7,7 @@ spring:
active: dev
cloud:
nacos:
server-addr: 172.19.255.105:8848
server-addr: 127.0.0.1:8848
username: nacos
password: nacos
config:

Loading…
Cancel
Save