|
|
@ -20,16 +20,25 @@ import com.sztzjy.forex.trading_trading.service.TrainingService;
|
|
|
|
import com.sztzjy.forex.trading_trading.util.BigDecimalUtils;
|
|
|
|
import com.sztzjy.forex.trading_trading.util.BigDecimalUtils;
|
|
|
|
import com.sztzjy.forex.trading_trading.util.ForexMarketDateUtil;
|
|
|
|
import com.sztzjy.forex.trading_trading.util.ForexMarketDateUtil;
|
|
|
|
import com.sztzjy.forex.trading_trading.util.ResultEntity;
|
|
|
|
import com.sztzjy.forex.trading_trading.util.ResultEntity;
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.util.excel.ExcelData;
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.util.excel.ExcelProvider;
|
|
|
|
|
|
|
|
import com.sztzjy.forex.trading_trading.util.file.IFileUtil;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
|
|
|
import org.springframework.util.Assert;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
|
|
|
|
|
import java.text.NumberFormat;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -60,6 +69,9 @@ public class MemberController {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
ForexMarketDateUtil forexMarketDateUtil;
|
|
|
|
ForexMarketDateUtil forexMarketDateUtil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
IFileUtil fileUtil;
|
|
|
|
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
@AnonymousAccess
|
|
|
|
@PostMapping("getMemberById")
|
|
|
|
@PostMapping("getMemberById")
|
|
|
|
public ResultEntity getMember(@RequestBody String memberId) {
|
|
|
|
public ResultEntity getMember(@RequestBody String memberId) {
|
|
|
@ -128,12 +140,13 @@ public class MemberController {
|
|
|
|
@ApiParam("页量") @RequestParam(required = false) Integer size) {
|
|
|
|
@ApiParam("页量") @RequestParam(required = false) Integer size) {
|
|
|
|
|
|
|
|
|
|
|
|
JwtUser jwtUser = TokenProvider.getJWTUser(request);
|
|
|
|
JwtUser jwtUser = TokenProvider.getJWTUser(request);
|
|
|
|
PageInfo<MemberVO> pageInfo = memberService.pagedListMembers(className, trainingName, markStatus, keyword, jwtUser.getSchoolId(),index, size);
|
|
|
|
PageInfo<MemberVO> pageInfo = memberService.pagedListMembers(className, trainingName, markStatus, keyword, jwtUser,index, size);
|
|
|
|
if (!pageInfo.getList().isEmpty()) {
|
|
|
|
if (!pageInfo.getList().isEmpty()) {
|
|
|
|
for (MemberVO vo : pageInfo.getList()) {
|
|
|
|
for (MemberVO vo : pageInfo.getList()) {
|
|
|
|
Training training = trainingService.findById(vo.getTrainingId());
|
|
|
|
Training training = trainingService.findById(vo.getTrainingId());
|
|
|
|
if (vo.getYield() == null || training == null) continue;
|
|
|
|
if (vo.getYield() == null || training == null) continue;
|
|
|
|
vo.setTradeTrainingScore(gradeWeightService.findWeightByWeightIdAndYield(training.getWeightId(), vo.getYield()).getActualScore());
|
|
|
|
vo.setTradeTrainingScore(gradeWeightService.findWeightByWeightIdAndYield(training.getWeightId(), vo.getYield()).getActualScore());
|
|
|
|
|
|
|
|
vo.setTotalScore(vo.getTradeTrainingScore() + (vo.getReportScore()==null?0:vo.getReportScore()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new ResultEntity<PageInfo<MemberVO>>(pageInfo);
|
|
|
|
return new ResultEntity<PageInfo<MemberVO>>(pageInfo);
|
|
|
@ -148,20 +161,45 @@ public class MemberController {
|
|
|
|
@ApiParam("查询关键字:学号或学生名称") String keyword,
|
|
|
|
@ApiParam("查询关键字:学号或学生名称") String keyword,
|
|
|
|
String TOKEN,
|
|
|
|
String TOKEN,
|
|
|
|
HttpServletResponse response) throws FileNotFoundException {
|
|
|
|
HttpServletResponse response) throws FileNotFoundException {
|
|
|
|
TokenProvider.getJWTUser(TOKEN);
|
|
|
|
JwtUser jwtUser = TokenProvider.getJWTUser(TOKEN);
|
|
|
|
memberService.exportMembers(className, trainingName, markStatus, keyword, response);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<MemberVO> members = memberService.exportMembers(className, trainingName, markStatus, keyword, jwtUser, response);
|
|
|
|
|
|
|
|
Assert.notNull(members, "没有可导出数据");
|
|
|
|
|
|
|
|
List<String> titles = Arrays.asList("实训任务名称", "班级", "学号", "姓名", "排名", "累计盈亏", "收益率", "模拟交易实训成绩", "实训报告成绩", "总成绩");
|
|
|
|
|
|
|
|
ExcelData excelData = ExcelData.create(titles);
|
|
|
|
|
|
|
|
for (MemberVO member : members) {
|
|
|
|
|
|
|
|
List<Object> rows = new ArrayList<>();
|
|
|
|
|
|
|
|
rows.add(member.getTrainingName());
|
|
|
|
|
|
|
|
rows.add(member.getClassGrade());
|
|
|
|
|
|
|
|
rows.add(member.getStudentNumber());
|
|
|
|
|
|
|
|
rows.add(member.getName());
|
|
|
|
|
|
|
|
rows.add(member.getStuRank());
|
|
|
|
|
|
|
|
rows.add(member.getCumulativeProfitLoss());
|
|
|
|
|
|
|
|
rows.add(member.getYield());
|
|
|
|
|
|
|
|
rows.add(member.getTradeTrainingScore());
|
|
|
|
|
|
|
|
rows.add(member.getReportScore());
|
|
|
|
|
|
|
|
rows.add(member.getTotalScore());
|
|
|
|
|
|
|
|
excelData.addRow(rows);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String fileName = "学生排行榜数据.xlsx";
|
|
|
|
|
|
|
|
String file = fileUtil.getFullPath(fileName);
|
|
|
|
|
|
|
|
FileOutputStream fileOut = new FileOutputStream(file);
|
|
|
|
|
|
|
|
ExcelProvider.SimpleExcelExport(excelData, fileOut);
|
|
|
|
|
|
|
|
fileUtil.download(response, fileName);
|
|
|
|
|
|
|
|
fileUtil.remove(file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Permission(codes = PermissionType.TRAINING_MANAGEMENT_SEARCH)
|
|
|
|
@Permission(codes = PermissionType.TRAINING_MANAGEMENT_SEARCH)
|
|
|
|
@ApiOperation("根据实训任务id获取成员列表")
|
|
|
|
@ApiOperation("根据实训任务id获取成员列表")
|
|
|
|
@GetMapping("listMembersByTrainingId")
|
|
|
|
@GetMapping("listMembersByTrainingId")
|
|
|
|
public ResultEntity<PageInfo<Member>> listMembersByTrainingId(@RequestParam String trainingId,
|
|
|
|
public ResultEntity<PageInfo<MemberVO>> listMembersByTrainingId(@RequestParam String trainingId,
|
|
|
|
@ApiParam("班级id") Integer classId,
|
|
|
|
@ApiParam("班级id") Integer classId,
|
|
|
|
@ApiParam("查询关键字:学号和姓名")String keyword,
|
|
|
|
@ApiParam("查询关键字:学号和姓名")String keyword,
|
|
|
|
@RequestParam Integer index,
|
|
|
|
@RequestParam Integer index,
|
|
|
|
@RequestParam Integer size) {
|
|
|
|
@RequestParam Integer size) {
|
|
|
|
PageInfo<Member> members = memberService.pageListMemberByTrainingId(trainingId, classId,keyword,index, size);
|
|
|
|
PageInfo<MemberVO> members = memberService.pageListMemberByTrainingId(trainingId, classId,keyword,index, size);
|
|
|
|
return new ResultEntity<PageInfo<Member>>(members);
|
|
|
|
return new ResultEntity<PageInfo<MemberVO>>(members);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|