This commit is contained in:
zhouwentao 2024-05-13 18:45:57 +08:00
parent 556a77ede4
commit 4ef7a221d1
15 changed files with 96 additions and 35 deletions

View File

@ -3,6 +3,7 @@ package org.jeecg.modules.mini.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -20,6 +21,7 @@ import java.util.Set;
*/
@Data
@ApiModel(value = "小程序端-院校信息对象")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class MiniSchoolDTO implements Serializable {
/**主键*/

View File

@ -42,8 +42,7 @@ public class ArtRecommendMajorController {
IYxCalculationMajorService yxCalculationMajorService;
@Resource
MiniTestCulturalService testCulturalService;
@Resource
private RedisUtil redisUtil;
@ApiOperation(value = "获取可报专业总数")
@GetMapping("/recommendMajorCount")

View File

@ -7,11 +7,16 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.AssertUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.mini.service.MiniTestCulturalService;
import org.jeecg.modules.web.service.WebMajorService;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.yx.entity.YxMajor;
import org.jeecg.modules.yx.service.IYxCalculationMajorService;
import org.jeecg.modules.yx.service.IYxMajorService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -37,7 +42,16 @@ public class WebMajorController {
@Resource
WebMajorService webMajorService;
@Resource
MiniTestCulturalService testCulturalService;
@Resource
IYxCalculationMajorService yxCalculationMajorService;
@Resource
RedisUtil redisUtil;
@GetMapping(value = "/recommendMajor/page")
public Result<?> recommendMajorPage(QueryRecommendMajorVO queryRecommendMajorVO) {
return Result.OK(yxCalculationMajorService.recommendMajorPage(queryRecommendMajorVO));
}
/**
* 网站前台 查专业 列表
*/
@ -84,4 +98,16 @@ public class WebMajorController {
public Result<?> schoolMajorList(QueryRecommendMajorVO queryRecommendMajorVO) {
return Result.OK(webMajorService.schoolMajorList(queryRecommendMajorVO));
}
@ApiOperation(value = "文化分测算")
@GetMapping(value = "/testCultural")
public Result<?> testCultural(QueryRecommendMajorVO queryRecommendMajorVO) {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//根据 院校代码获取 院校的招生专业计算各专业的录取分数
String schoolCode = queryRecommendMajorVO.getSchoolCode();
String year = queryRecommendMajorVO.getYear();
AssertUtils.notNull(loginUser, "未获取到登录信息");
AssertUtils.notNull(year, "请选择年份");
return Result.OK(testCulturalService.testCultural(schoolCode, year));
}
}

View File

@ -12,9 +12,12 @@ import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.web.vo.SaveVolunteerVO;
import org.jeecg.modules.yx.dto.VolunteerDTO;
import org.jeecg.modules.yx.entity.YxUserScore;
import org.jeecg.modules.yx.entity.YxVolunteer;
import org.jeecg.modules.yx.entity.YxVolunteerRecord;
import org.jeecg.modules.yx.service.IYxUserScoreService;
import org.jeecg.modules.yx.service.IYxVolunteerRecordService;
import org.jeecg.modules.yx.service.IYxVolunteerService;
import org.jeecg.modules.yx.service.impl.UserScoreService;
@ -38,6 +41,8 @@ public class WebVolunteerController {
private IYxVolunteerRecordService yxVolunteerRecordService;
@Resource
private IYxVolunteerService yxVolunteerService;
@Resource
private IYxUserScoreService yxUserScoreService;
@GetMapping(value = "/volunteerList")
@ApiOperation(value = "获取志愿表列表")
@ -102,21 +107,26 @@ public class WebVolunteerController {
return Result.OK(userScoreService.todayOfEditScoreCount());
}
public static void main(String[] args) {
Integer closestNextValue = null;
Integer[] valuesArray =new Integer[]{2,3,4};
//冒泡排序
//valuesArray.sort((a, b) => a - b);
// 找到缺失的数字或者接近的下一个值
for (int i = 0; i < valuesArray.length; i++) {
if (valuesArray[i] == i + 1) {
closestNextValue = i + 1;
break;
@ApiOperation(value = "切换志愿单", notes = "切换志愿单")
@PostMapping(value = "/switchVolunteer")
public Result<String> switchVolunteer(@RequestBody SaveVolunteerVO saveVolunteerVO) {
String id = saveVolunteerVO.getId();
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
YxVolunteer volunteer = yxVolunteerService.getById(id);
if (volunteer!=null) {
String scoreId = volunteer.getScoreId();
if (StringUtils.isNotBlank(scoreId)) {
//修改当前用户的所有志愿单状态 0
yxVolunteerService.update(new LambdaUpdateWrapper<YxVolunteer>().eq(YxVolunteer::getCreateBy,user.getId()).set(YxVolunteer::getState,0));
//修改当前用户的成绩状态 0
yxUserScoreService.update(new LambdaUpdateWrapper<YxUserScore>().eq(YxUserScore::getCreateBy,user.getId()).set(YxUserScore::getState,0));
//开启志愿单及成绩
//修改当前用户志愿单状态 1
yxVolunteerService.update(new LambdaUpdateWrapper<YxVolunteer>().eq(YxVolunteer::getCreateBy,user.getId()).eq(YxVolunteer::getId,id).set(YxVolunteer::getState,1));
//修改当前用户的成绩状态 0
yxUserScoreService.update(new LambdaUpdateWrapper<YxUserScore>().eq(YxUserScore::getCreateBy,user.getId()).eq(YxUserScore::getId,scoreId).set(YxUserScore::getState,1));
}
}
if (closestNextValue == null) {
closestNextValue = valuesArray[valuesArray.length - 1] + 1;
}
System.out.println(closestNextValue);
return Result.OK("操作成功");
}
}

View File

@ -1,13 +1,14 @@
package org.jeecg.modules.web.service;
import com.alibaba.fastjson.JSONObject;
import net.sf.json.JSON;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.jeecg.modules.web.dto.RecommendMajorDTO;
import org.jeecg.modules.web.dto.WebMajorDTO;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.yx.dto.UserScoreDTO;
import org.jeecg.modules.yx.mapper.YxMajorMapper;
import org.jeecg.modules.yx.service.IYxUserScoreService;
import org.jeecg.modules.yx.service.impl.UserScoreService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -24,6 +25,8 @@ import java.util.stream.Collectors;
public class WebMajorService {
@Resource
YxMajorMapper yxMajorMapper;
@Resource
UserScoreService userScoreService;
/**
* 网页端-专业列表
*/
@ -50,6 +53,8 @@ public class WebMajorService {
* @return
*/
public List<RecommendMajorDTO> schoolMajorList(QueryRecommendMajorVO queryRecommendMajorVO){
UserScoreDTO activeCurrentUserScoreInfo = userScoreService.getActiveCurrentUserScoreInfo();
queryRecommendMajorVO.setProfessionalCategory(activeCurrentUserScoreInfo.getScoreInfo().getProfessionalCategory());
return yxMajorMapper.webSchoolMajorList(queryRecommendMajorVO);
}
}

View File

@ -74,4 +74,6 @@ public class YxConstant {
public static String newCalculationMajorName = "yx_calculation_major";
public static BigDecimal bigDecimal10 = new BigDecimal("10");
public static BigDecimal bigDecimal025 = new BigDecimal("0.25");
public static final String REDIS_SCORE_KEY="USER_SCORE_";
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -20,6 +21,7 @@ import java.util.Date;
*/
@Data
@ApiModel(value = "PC端用户成绩返回对象")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class UserScoreInfo implements Serializable {
@TableId(type = IdType.ASSIGN_ID)
private String id;

View File

@ -14,5 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface YxHistoryMajorEnrollMapper extends BaseMapper<YxHistoryMajorEnroll> {
List<YxHistoryMajorEnroll> getDataGroupBySchoolCodeAndMaxYear(@Param("schoolCodeList") List<String> schoolCodeList);
List<YxHistoryMajorEnroll> getDataGroupBySchoolCodeAndMaxYear(@Param("professionalCategory")String professionalCategory,@Param("schoolCodeList") List<String> schoolCodeList);
}

View File

@ -4,18 +4,28 @@
<select id="getDataGroupBySchoolCodeAndMaxYear"
resultType="org.jeecg.modules.yx.entity.YxHistoryMajorEnroll">
SELECT school_code as schoolCode,
max(year) as year,
min_admission_line as admissionLine
FROM (
SELECT school_code, year, MIN(admission_line) AS min_admission_line
SELECT school_code AS schoolCode, MAX(year) AS year, MIN(admission_line) AS admissionLine
FROM yx_history_major_enroll
WHERE school_code IN
<foreach collection="schoolCodeList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
GROUP BY school_code, year
) ss
GROUP BY school_code;
AND major_type = #{professionalCategory} AND admission_line &gt;0
GROUP BY school_code
<!-- SELECT school_code as schoolCode,-->
<!-- max(year) as year,-->
<!-- min_admission_line as admissionLine-->
<!-- FROM (-->
<!-- SELECT school_code, year, MIN(admission_line) AS min_admission_line-->
<!-- FROM yx_history_major_enroll-->
<!-- WHERE school_code IN-->
<!-- <foreach collection="schoolCodeList" index="index" item="id" open="(" separator="," close=")">-->
<!-- #{id}-->
<!-- </foreach>-->
<!-- AND major_type = #{professionalCategory}-->
<!-- GROUP BY school_code, year-->
<!-- ) ss-->
<!-- GROUP BY school_code;-->
</select>
</mapper>

View File

@ -44,6 +44,9 @@
<if test="q.cognitioPolyclinic!=null and q.cognitioPolyclinic!=''">
AND sm.category = #{q.cognitioPolyclinic}
</if>
<if test="q.professionalCategory!=null and q.professionalCategory!=''">
AND sm.major_type = #{q.professionalCategory}
</if>
</where>
</select>
</mapper>

View File

@ -23,7 +23,7 @@ public interface IYxHistoryMajorEnrollService extends IService<YxHistoryMajorEnr
* @param schoolCodeList 院校编码
* @return Map<院校编码,数据>
*/
Map<String,YxHistoryMajorEnroll> getDataGroupBySchoolCodeAndMaxYear(List<String> schoolCodeList);
Map<String,YxHistoryMajorEnroll> getDataGroupBySchoolCodeAndMaxYear(String professionalCategory,List<String> schoolCodeList);
/**
* 给推荐专业列表写入历年分数信息

View File

@ -7,6 +7,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.AssertUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.web.dto.ArtRecommendMajorBaseDTO;
import org.jeecg.modules.yx.constant.YxConstant;
import org.jeecg.modules.yx.dto.UserScoreInfo;
@ -24,6 +25,8 @@ import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.jeecg.modules.yx.constant.YxConstant;
/**
* 通用-用户分数Service
*
@ -36,6 +39,8 @@ public class UserScoreService {
private YxUserScoreMapper yxUserScoreMapper;
@Resource
private YxVolunteerMapper yxVolunteerMapper;
@Resource
private RedisUtil redisUtil;
/**
* 获取当前用户的分数成绩一些列信息
@ -43,6 +48,7 @@ public class UserScoreService {
public UserScoreDTO getActiveCurrentUserScoreInfo() {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
AssertUtils.notNull(loginUser, "请先登录!");
//从redis查询是否有成绩
try {
//获取用户
UserScoreInfo userScoreInfo = this.getActiveUserScore(loginUser.getId());

View File

@ -512,10 +512,6 @@ public class YxCalculationMajorServiceImpl extends ServiceImpl<YxCalculationMajo
recommendMajorDTO.setStudentConvertedScore(studentScore);
recommendMajorDTO.setStudentScore(studentScore);
if (recommendMajorDTO.getSchoolCode().equals("6198") && "06".equals(recommendMajorDTO.getEnrollmentCode())) {
System.out.println("1111");
}
//录取方式计算
if (rulesEnrollProbability.equals("文过专排主科")) {
if (CollectionUtils.isEmpty(historyMajorEnrollList)) {

View File

@ -54,8 +54,8 @@ public class YxHistoryMajorEnrollServiceImpl extends ServiceImpl<YxHistoryMajorE
}
@Override
public Map<String,YxHistoryMajorEnroll> getDataGroupBySchoolCodeAndMaxYear(List<String> schoolCodeList) {
List<YxHistoryMajorEnroll> list = baseMapper.getDataGroupBySchoolCodeAndMaxYear(schoolCodeList);
public Map<String,YxHistoryMajorEnroll> getDataGroupBySchoolCodeAndMaxYear(String professionalCategory,List<String> schoolCodeList) {
List<YxHistoryMajorEnroll> list = baseMapper.getDataGroupBySchoolCodeAndMaxYear(professionalCategory,schoolCodeList);
Map<String,YxHistoryMajorEnroll> dataMaps=new LinkedHashMap<>();
for (YxHistoryMajorEnroll yxHistoryMajorEnroll : list) {
dataMaps.put(yxHistoryMajorEnroll.getSchoolCode(),yxHistoryMajorEnroll);

View File

@ -80,7 +80,7 @@ public class YxSchoolServiceImpl extends ServiceImpl<YxSchoolMapper, YxSchool> i
if (CollectionUtils.isNotEmpty(dtoPage.getRecords())) {
//获取 院校下的上一年招生信息
List<String> schoolCodeList = dtoPage.getRecords().stream().map(MiniSchoolDTO::getSchoolCode).collect(Collectors.toList());
Map<String, YxHistoryMajorEnroll> historyMajorEnrollMap = yxHistoryMajorEnrollService.getDataGroupBySchoolCodeAndMaxYear(schoolCodeList);
Map<String, YxHistoryMajorEnroll> historyMajorEnrollMap = yxHistoryMajorEnrollService.getDataGroupBySchoolCodeAndMaxYear(professionalCategory,schoolCodeList);
//获取校考数据
LambdaQueryWrapper<YxSchoolMajor> schoolMajorLambdaQueryWrapper = new LambdaQueryWrapper<>();
schoolMajorLambdaQueryWrapper.select(YxSchoolMajor::getSchoolCode);