Commit 56cfc490 authored by cy's avatar cy

方案优化,个人信息返回综合分

parent 7ae9aec0
......@@ -80,7 +80,6 @@
<include refid="table"/>
<where>
is_delete=0
order by create_time desc
limit #{pageNo},#{pageSize}
</where>
......
......@@ -63,4 +63,10 @@ public class UserShowVo implements Serializable {
*/
@ApiModelProperty(value = "类型(专科、本科)",name = "gradeType")
private String gradeType;
/**
* 综合成绩
*/
@ApiModelProperty(value = "综合成绩",name = "ComprehensiveScore")
private Double ComprehensiveScore;
}
......@@ -6,6 +6,7 @@ import cn.wisenergy.model.dto.RefillCardDto;
import com.github.pagehelper.PageInfo;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
public interface RefillCardService {
......
......@@ -162,8 +162,7 @@ public class RefillCardServiceImpl implements RefillCardService {
}).collect(Collectors.toList());
// 设置文件名称
String fileName = batchNumber;
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
response.setHeader("Content-disposition", "attachment;filename=" + batchNumber + ".xlsx");
// sheet名称
EasyExcel.write(response.getOutputStream(), ExportCardDto.class).sheet(batchNumber).doWrite(resultBo);
return R.ok(0,true);
......
......@@ -1030,35 +1030,73 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
for (Map.Entry<Double, List<Volunteer>> entry : mapObj.entrySet()) {
List<Volunteer> volunteers = entry.getValue();
if (volunteers.size() > 1) {
Random mRandom = new Random();
int count = mRandom.nextInt(volunteers.size());
//判断限制专业
String courseDemand = volunteers.get(count).getCourseDemand();
if(courseDemand.contains("和")){
String[] course = courseDemand.split("和");
for (String co : course) {
if (!classStr.contains(co)) {
volunteers.remove(count);
break;
if (volunteers.size() > 2) {
for (int i = 0; i < 2; i++) {
Random mRandom = new Random();
int count = mRandom.nextInt(volunteers.size());
//判断限制专业
String courseDemand = volunteers.get(count).getCourseDemand();
if(courseDemand.contains("和")){
String[] course = courseDemand.split("和");
for (String co : course) {
if (!classStr.contains(co)) {
volunteers.remove(count);
break;
}
}
}else{
resultList.add(volunteers.get(count));
volunteers.remove(count);
otherList.addAll(volunteers);
}
}else{
resultList.add(volunteers.get(count));
volunteers.remove(count);
otherList.addAll(volunteers);
}
} else {
resultList.addAll(volunteers);
}
if (resultList.size() >= totalNumber) {
Collections.shuffle(resultList);
return resultList.subList(0, totalNumber);
}
}
Map<Double, List<Volunteer>> mapObje = otherList.stream().collect(Collectors.groupingBy(Volunteer::getLowestMark
));
for (Map.Entry<Double, List<Volunteer>> entry : mapObje.entrySet()) {
List<Volunteer> volunteers = entry.getValue();
if (volunteers.size() > 2) {
for (int i = 0; i < 2; i++) {
Random mRandom = new Random();
int count = mRandom.nextInt(volunteers.size());
//判断限制专业
String courseDemand = volunteers.get(count).getCourseDemand();
if(courseDemand.contains("和")){
String[] course = courseDemand.split("和");
for (String co : course) {
if (!classStr.contains(co)) {
volunteers.remove(count);
break;
}
}
}else{
resultList.add(volunteers.get(count));
volunteers.remove(count);
otherList.addAll(volunteers);
}
}
} else {
resultList.addAll(volunteers);
}
if (resultList.size() >= totalNumber) {
Collections.shuffle(resultList);
return resultList.subList(0, totalNumber);
}
}
//从剩下的数据中随机抽取,添满数组
Collections.shuffle(otherList);
if (resultList.size() < totalNumber) {
int num = totalNumber - resultList.size();
List<Volunteer> volunteers = new ArrayList<>();
......
......@@ -32,6 +32,8 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
......@@ -279,6 +281,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
userShowVo.setScoreInfo(scoreInfo);
//文化课考生
if (StudentType.CULTURE_STUDENT.getCode().equals(user.getExamType())) {
userShowVo.setComprehensiveScore(scoreInfo.getCultureGrade());
AdmissionRule firstRule = admissionRuleMapper.getByType(SchemeTypeEnums.UNDERGRADUATE_CULTURE.getCode());
if (null != firstRule) {
if (scoreInfo.getCultureGrade() >= firstRule.getCultureMin()) {
......@@ -290,6 +293,9 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
}
//美术考生
if (StudentType.ART_STUDENT.getCode().equals(user.getExamType())) {
//综合成绩=专业成绩*750/300*70%+文化成绩*30%
double score=scoreInfo.getMajorGrade() * 750 / 300 * 0.7 + scoreInfo.getCultureGrade() * 0.3;
userShowVo.setComprehensiveScore(new BigDecimal(score).setScale(2, RoundingMode.UP).doubleValue());
AdmissionRule firstRule = admissionRuleMapper.getByType(SchemeTypeEnums.UNDERGRADUATE_ARTS.getCode());
if (null != firstRule) {
if (scoreInfo.getCultureGrade() >= firstRule.getCultureMin() && scoreInfo.getMajorGrade() >= firstRule.getProfessionMin()) {
......@@ -301,6 +307,10 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
}
//文学编导考生
if (StudentType.LITERATURE_STUDENT.getCode().equals(user.getExamType())) {
//综合成绩=专业成绩*750/300*70%+文化成绩*30%
Double score=scoreInfo.getMajorGrade() * 750 / 300 * 0.7 + scoreInfo.getCultureGrade() * 0.3;
userShowVo.setComprehensiveScore(new BigDecimal(score).setScale(2, RoundingMode.UP).doubleValue());
AdmissionRule firstRule = admissionRuleMapper.getByType(SchemeTypeEnums.UNDERGRADUATE_LITERATURE.getCode());
if (null != firstRule) {
if (scoreInfo.getCultureGrade() >= firstRule.getCultureMin() && scoreInfo.getMajorGrade() >= firstRule.getProfessionMin()) {
......@@ -312,8 +322,10 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
}
//体育考生
if (StudentType.SPORTS_STUDENT.getCode().equals(user.getExamType())) {
//综合成绩=专业成绩*750/100*70%+文化成绩*30%
AdmissionRule firstRule = admissionRuleMapper.getByType(SchemeTypeEnums.UNDERGRADUATE_SPORTS.getCode());
double total = scoreInfo.getMajorGrade() * 750 / 100 * 0.7 + scoreInfo.getCultureGrade() * 0.3;
userShowVo.setComprehensiveScore(new BigDecimal(total).setScale(2, RoundingMode.UP).doubleValue());
if (null != firstRule) {
if (total >= firstRule.getCultureMin()) {
userShowVo.setGradeType(GradeType.UNDERGRADUATE.getDescription());
......@@ -321,7 +333,6 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
userShowVo.setGradeType(GradeType.SPECIALTY.getDescription());
}
}
}
}
return R.ok(userShowVo);
......@@ -537,5 +548,6 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
userKnownDto.setCreateTime(userKnown.getCreateTime());
return R.ok(userKnownDto);
}
}
......@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.math.BigInteger;
import java.util.Date;
@Api(tags = "充值卡管理")
@RestController
......
......@@ -3,8 +3,8 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
#url: jdbc:mysql://192.168.110.165:3306/volunteer?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
url: jdbc:mysql://localhost:3306/volunteer?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.110.165:3306/volunteer?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
#url: jdbc:mysql://localhost:3306/volunteer?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
#url: jdbc:mysql://rm-bp1i44rtb091fk06coo.mysql.rds.aliyuncs.com:3306/volunteer?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: adm4HYservice$
......
......@@ -4,8 +4,8 @@ server:
max-threads: 1000
min-spare-threads: 30
#port: 8997
port: 8080
port: 8997
#port: 8080
connection-timeout: 5000ms
spring:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment