更新
This commit is contained in:
zhouwentao 2024-04-29 13:04:40 +08:00
parent 1669e2f314
commit 082d95d839
35 changed files with 1230 additions and 243 deletions

View File

@ -1,11 +1,7 @@
package org.jeecg.modules.mini.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.gson.Gson;
@ -18,29 +14,16 @@ import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.mini.service.MiniArticleService;
import org.jeecg.modules.mini.vo.ImportArticleVO;
import org.jeecg.modules.mini.vo.QueryArticleVO;
import org.jeecg.modules.yx.dto.LiNianShuJuDTO;
import org.jeecg.modules.yx.dto.SchoolMajorImport3;
import org.jeecg.modules.yx.entity.*;
import org.jeecg.modules.yx.service.*;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description 文章接口

View File

@ -32,8 +32,6 @@ public class MiniMajorController {
@Autowired
private IYxCalculationMajorService yxCalculationMajorService;
@Autowired
private IYxSchoolExamMajorService yxSchoolExamMajorService;
@Autowired
private RedisUtil redisUtil;
@ApiOperation(value = "小程序端-智能推荐")
@ -106,7 +104,7 @@ public class MiniMajorController {
dataList.add(data);
}
json = JSONObject.toJSONString(dataList);
//redisUtil.set(key, json, 3600);
redisUtil.set(key, json, 3600);
}
return Result.OK(dataList);
}

View File

@ -13,17 +13,19 @@ import org.jeecg.modules.web.dto.ArtRecommendMajorBaseDTO;
import org.jeecg.modules.web.dto.RecommendMajorDTO;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.yx.constant.YxConstant;
import org.jeecg.modules.yx.dto.UserScoreDto;
import org.jeecg.modules.yx.dto.UserScoreDTO;
import org.jeecg.modules.yx.entity.YxHistoryScoreControlLine;
import org.jeecg.modules.yx.entity.YxScoreSegment;
import org.jeecg.modules.yx.entity.YxUserScore;
import org.jeecg.modules.yx.entity.YxVolunteer;
import org.jeecg.modules.yx.service.*;
import org.jeecg.modules.yx.service.impl.UserScoreService;
import org.jeecg.modules.yx.util.ScoreUtil;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -48,6 +50,8 @@ public class MiniUserScoreController {
private IYxHistoryScoreControlLineService yxHistoryScoreControlLineService;
@Autowired
private IYxScoreSegmentService yxScoreSegmentService;
@Resource
private UserScoreService userScoreService;
@PostMapping(value = "/save")
public Result<?> save(@NotNull @RequestBody YxUserScore yxUserScore) {
@ -217,55 +221,13 @@ public class MiniUserScoreController {
@GetMapping(value = "/getUserScoreInfo")
public Result<?> getUserScoreInfo() {
//获取分数信息
YxUserScore activeCurrentUserScore = yxUserScoreService.getActiveCurrentUserScore();
if (activeCurrentUserScore == null) {
return Result.OK();
}
//获取当前成绩下的第志愿单
LambdaQueryWrapper<YxVolunteer> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(YxVolunteer::getScoreId, activeCurrentUserScore.getId());
lambdaQueryWrapper.eq(YxVolunteer::getState, 1);
lambdaQueryWrapper.last("limit 1");
YxVolunteer yxVolunteer = yxVolunteerService.getOne(lambdaQueryWrapper);
//获取可报院校数量
QueryRecommendMajorVO queryRecommendMajorVO = new QueryRecommendMajorVO();
queryRecommendMajorVO.setBatch(activeCurrentUserScore.getBatch());
ArtRecommendMajorBaseDTO artRecommendMajorBaseDTO = new ArtRecommendMajorBaseDTO();
artRecommendMajorBaseDTO.setKbd(activeCurrentUserScore.getKbdNum());
artRecommendMajorBaseDTO.setJwt(activeCurrentUserScore.getJwtNum());
artRecommendMajorBaseDTO.setKcj(activeCurrentUserScore.getKcjNum());
artRecommendMajorBaseDTO.setNan(activeCurrentUserScore.getNlqNum());
artRecommendMajorBaseDTO.setAllNumber(activeCurrentUserScore.getKbdNum() + activeCurrentUserScore.getJwtNum() + activeCurrentUserScore.getKcjNum());
UserScoreDto userScoreDto = new UserScoreDto();
userScoreDto.setScoreInfo(activeCurrentUserScore);
userScoreDto.setVolunteer(yxVolunteer);
userScoreDto.setFillVolunteer(artRecommendMajorBaseDTO);
return Result.OK(userScoreDto);
return Result.OK(userScoreService.getActiveCurrentUserScoreInfo());
}
@ApiOperation(value = "今日编辑成绩的次数")
@GetMapping(value = "/todayOfEditScoreCount")
public Result<?> todayOfEditScoreCount() {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
JSONObject jsonObject = new JSONObject();
Date date = new Date();
String format = YxConstant.sdf.format(date);
String startTime = format + " 00:00:00";
String endTime = format + " 23:59:59";
LambdaQueryWrapper<YxUserScore> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.between(YxUserScore::getCreateTime, startTime, endTime);
lambdaQueryWrapper.eq(YxUserScore::getCreateBy, loginUser.getId());
long useCount = yxUserScoreService.count(lambdaQueryWrapper);
long residueCount = 0;
if (YxConstant.todayMaxEditScoreCount > useCount) {
//当天没有超过更改次数
residueCount = YxConstant.todayMaxEditScoreCount - useCount;
}
jsonObject.put("useCount", useCount);
jsonObject.put("residueCount", residueCount);
return Result.OK(jsonObject);
return Result.OK(userScoreService.todayOfEditScoreCount());
}
}

View File

@ -51,29 +51,11 @@ public class ArtRecommendMajorController {
return Result.OK(yxSchoolMajorService.recommendMajorCount(queryRecommendMajorVO));
}
@ApiOperation(value = "小程序端-推荐专业列表")
@GetMapping("/mini/page")
public Result<?> miniRecommendMajorPage(QueryRecommendMajorVO queryRecommendMajorVO) {
if (StringUtils.isNotBlank(queryRecommendMajorVO.getProvince())) {
queryRecommendMajorVO.setAddressList(Collections.singletonList(queryRecommendMajorVO.getProvince()));
}
ArtRecommendMajorBaseDTO artRecommendMajorBaseDTO = yxSchoolMajorService.recommendMajorPage(queryRecommendMajorVO);
return Result.OK(artRecommendMajorBaseDTO);
}
@ApiOperation(value = "小程序端-智能推荐")
@GetMapping("/mini/aiAuto")
public Result<?> aiAutoRecommendMajor(QueryRecommendMajorVO queryRecommendMajorVO) {
ArtRecommendMajorBaseDTO artRecommendMajorBaseDTO = yxSchoolMajorService.aiAutoRecommendMajor(queryRecommendMajorVO);
return Result.OK(artRecommendMajorBaseDTO);
}
@ApiOperation(value = "推荐专业列表")
@GetMapping("/page")
public Result<?> recommendMajorPage(QueryRecommendMajorVO queryRecommendMajorVO) {
return Result.OK(yxCalculationMajorService.recommendMajorPage(queryRecommendMajorVO));
/*ArtRecommendMajorBaseDTO artRecommendMajorBaseDTO = yxSchoolMajorService.recommendMajorPage(queryRecommendMajorVO);
return Result.OK(artRecommendMajorBaseDTO);*/
}
@ApiOperation(value = "学院专业列表")

View File

@ -24,13 +24,6 @@ public class ArtSchoolController {
@Autowired
private IYxSchoolService yxSchoolService;
@ApiOperation(value = "热门院校")
@GetMapping(value = "/hotList")
public Result<?> hotList(){
return Result.OK(yxSchoolService.hotList());
}
@ApiOperation(value = "搜索学校")
@GetMapping("/search")
public Result<?> search(QueryRecommendMajorVO queryRecommendMajorVO){

View File

@ -0,0 +1,81 @@
package org.jeecg.modules.web.controller;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.RedisUtil;
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.IYxMajorService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author ZhouWenTao
* @create 2024-04-26-14:42
*/
@RequestMapping("/web/major")
@RestController
@Api(tags = "网站前台-专业信息接口")
@Slf4j
public class WebMajorController {
@Resource
IYxMajorService yxMajorService;
@Resource
WebMajorService webMajorService;
@Resource
RedisUtil redisUtil;
/**
* 网站前台 查专业 列表
*/
@ApiOperation(value = "专业列表")
@GetMapping("/list")
public Result<?> list(QueryRecommendMajorVO queryRecommendMajorVO){
return Result.OK(webMajorService.webMajorList(queryRecommendMajorVO));
}
@ApiOperation(value = "专业类型列表")
@GetMapping("/typeList")
public Result<?> typeList(QueryRecommendMajorVO queryRecommendMajorVO){
String educationalLevel = queryRecommendMajorVO.getEducationalLevel();
String redisKey = "web:major:typeList";
String json = null;
if (StringUtils.isNotBlank(educationalLevel)) {
redisKey+="_educationalLevel_"+educationalLevel;
}
//先判断redis有没有
if(redisUtil.hasKey(redisKey)){
json =(String) redisUtil.get(redisKey);
List<String> javaList = JSONArray.parseArray(json).toJavaList(String.class);
return Result.OK(javaList);
}else{
//查数据库
LambdaQueryWrapper<YxMajor> lambdaQueryWrapper=new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(queryRecommendMajorVO.getEducationalLevel())) {
lambdaQueryWrapper.eq(YxMajor::getEducationalLevel,queryRecommendMajorVO.getEducationalLevel());
}
lambdaQueryWrapper.select(YxMajor::getZyl);
lambdaQueryWrapper.isNotNull(YxMajor::getZyl);
lambdaQueryWrapper.groupBy(YxMajor::getZyl);
List<YxMajor> list = yxMajorService.list(lambdaQueryWrapper);
if (CollectionUtils.isEmpty(list)) {
return Result.OK(new ArrayList<>());
}
List<String> zylList = list.stream().map(YxMajor::getZyl).collect(Collectors.toList());
redisUtil.set(redisKey,JSONArray.toJSONString(zylList),6000);
return Result.OK(zylList);
}
}
}

View File

@ -0,0 +1,65 @@
package org.jeecg.modules.web.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.yx.dto.UserScoreDTO;
import org.jeecg.modules.yx.entity.YxUserScore;
import org.jeecg.modules.yx.entity.YxVolunteer;
import org.jeecg.modules.yx.service.IYxUserScoreService;
import org.jeecg.modules.yx.service.IYxVolunteerService;
import org.jeecg.modules.yx.service.impl.UserScoreService;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author ZhouWenTao
* @create 2024-04-21-15:00
*/
@RequestMapping("/web/user/score")
@RestController
@Api(tags = "前台用户成绩接口")
@Slf4j
public class WebUserScoreController {
@Resource
private UserScoreService userScoreService;
@Resource
private IYxUserScoreService yxUserScoreService;
@Resource
private IYxVolunteerService yxVolunteerService;
@GetMapping(value = "/scoreList")
@ApiOperation(value = "获取志愿表列表")
public Result<?> volunteerList(){
try {
return Result.OK(userScoreService.volunteerListUser(null));
}catch (Exception e){
return Result.error(e.getMessage());
}
}
@GetMapping(value = "/getUserScoreInfo")
@ApiOperation(value = "获取当前用户的成绩信息")
public Result<?> getUserScoreInfo() {
//获取分数信息
return Result.OK(userScoreService.getActiveCurrentUserScoreInfo());
}
@ApiOperation(value = "今日编辑成绩的次数")
@GetMapping(value = "/todayOfEditScoreCount")
public Result<?> todayOfEditScoreCount() {
return Result.OK(userScoreService.todayOfEditScoreCount());
}
}

View File

@ -0,0 +1,122 @@
package org.jeecg.modules.web.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import io.swagger.annotations.Api;
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.modules.yx.dto.VolunteerDTO;
import org.jeecg.modules.yx.entity.YxVolunteer;
import org.jeecg.modules.yx.entity.YxVolunteerRecord;
import org.jeecg.modules.yx.service.IYxVolunteerRecordService;
import org.jeecg.modules.yx.service.IYxVolunteerService;
import org.jeecg.modules.yx.service.impl.UserScoreService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author ZhouWenTao
* @create 2024-04-21-15:00
*/
@RequestMapping("/web/volunteer")
@RestController
@Api(tags = "前台-志愿表接口")
@Slf4j
public class WebVolunteerController {
@Resource
private UserScoreService userScoreService;
@Resource
private IYxVolunteerRecordService yxVolunteerRecordService;
@Resource
private IYxVolunteerService yxVolunteerService;
@GetMapping(value = "/volunteerList")
@ApiOperation(value = "获取志愿表列表")
public Result<?> volunteerList(){
try {
LoginUser loginUser=(LoginUser) SecurityUtils.getSubject().getPrincipal();
String userId = loginUser.getId();
LambdaQueryWrapper<YxVolunteer> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(YxVolunteer::getCreateBy,userId);
lambdaQueryWrapper.in(YxVolunteer::getState,"0","1");
lambdaQueryWrapper.orderByDesc(YxVolunteer::getState,YxVolunteer::getCreateTime);
return Result.OK(yxVolunteerService.list(lambdaQueryWrapper));
}catch (Exception e){
return Result.error(e.getMessage());
}
}
@PostMapping(value = "/saveBatch")
@ApiOperation(value = "批量添加志愿明细信息")
public Result<?> saveBatch(@RequestBody JSONObject jsonObject) {
JSONArray list = jsonObject.getJSONArray("list");
if (CollectionUtils.isEmpty(list)) {
return Result.error("请求参数有误");
}
List<YxVolunteerRecord> volunteerRecordList = list.toJavaList(YxVolunteerRecord.class);
return yxVolunteerService.saveVolunteerBatch(volunteerRecordList);
}
@PostMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除志愿明细信息")
public Result<?> deleteBatch(@RequestBody JSONObject jsonObject){
JSONArray list = jsonObject.getJSONArray("list");
List<String> volunteerRecordIdList = list.toJavaList(String.class);
return yxVolunteerService.deleteVolunteerRecordBatch(volunteerRecordIdList);
}
@PostMapping(value = "/editNowVolunteerName")
@ApiOperation(value = "更改当前用户的志愿表名称")
public Result<?> editNowVolunteerName(@RequestBody YxVolunteer volunteer){
if(StringUtils.isBlank(volunteer.getVolunteerName())){
return Result.error("请输入志愿表名称");
}
LoginUser loginUser=(LoginUser) SecurityUtils.getSubject().getPrincipal();
VolunteerDTO volunteerDTO = yxVolunteerService.getActiveByCreate(loginUser.getId());
if (volunteerDTO==null) {
return Result.error("修改失败,未获取到志愿表信息");
}
try {
String id = volunteerDTO.getId();
LambdaUpdateWrapper<YxVolunteer> updateWrapper=new LambdaUpdateWrapper<>();
updateWrapper.eq(YxVolunteer::getId,id);
updateWrapper.set(YxVolunteer::getVolunteerName,volunteer.getVolunteerName());
yxVolunteerService.update(updateWrapper);
return Result.OK("操作成功");
}catch (Exception e){
return Result.error(e.getMessage());
}
}
@ApiOperation(value = "今日编辑成绩的次数")
@GetMapping(value = "/todayOfEditScoreCount")
public Result<?> todayOfEditScoreCount() {
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;
}
}
if (closestNextValue == null) {
closestNextValue = valuesArray[valuesArray.length - 1] + 1;
}
System.out.println(closestNextValue);
}
}

View File

@ -28,4 +28,23 @@ public class ArtRecommendMajorBaseDTO implements Serializable {
public ArtRecommendMajorBaseDTO() {
}
public ArtRecommendMajorBaseDTO(Integer kcj, Integer jwt, Integer kbd, Integer nan) {
this.kcj = kcj;
this.jwt = jwt;
this.kbd = kbd;
this.nan = nan;
try {
this.allNumber = kcj+jwt+kbd+nan;
}catch (Exception e){
this.allNumber = 0;
}
}
public ArtRecommendMajorBaseDTO(Integer kcj, Integer jwt, Integer kbd, Integer nan, Integer allNumber) {
this.kcj = kcj;
this.jwt = jwt;
this.kbd = kbd;
this.nan = nan;
this.allNumber = allNumber;
}
}

View File

@ -0,0 +1,36 @@
package org.jeecg.modules.web.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
/**
* 推荐专业的历年信息
* @author ZhouWenTao
* @create 2024-04-24-12:28
*/
@Data
@ApiModel(value = "专业的历年信息")
public class RecommendHistoryMajorDTO implements Serializable {
/**年份*/
@ApiModelProperty(value = "年份")
private java.lang.String year;
/**录取方式*/
@ApiModelProperty(value = "录取方式")
private java.lang.String rulesEnrollProbability;
/**录取概率计算规则运算符*/
@ApiModelProperty(value = "录取方式运算符")
private java.lang.String probabilityOperator;
/**省控线*/
// @ApiModelProperty(value = "省控线")
// private java.math.BigDecimal controlLine;
/**录取线*/
@ApiModelProperty(value = "录取线")
private java.math.BigDecimal admissionLine;
/**招生人数*/
@ApiModelProperty(value = "招生人数")
private java.lang.Integer enrollNum;
}

View File

@ -36,6 +36,8 @@ public class RecommendMajorDTO implements Serializable {
private String province;
@ApiModelProperty(value = "办学类型")
private String propertyName;
@ApiModelProperty(value = "办学性质")
private String schoolNature;
@ApiModelProperty(value = "院校类型")
private String institutionType;
@ApiModelProperty(value = "专业名称")
@ -78,6 +80,11 @@ public class RecommendMajorDTO implements Serializable {
@ApiModelProperty(value = "学年制")
private Integer studyYear=0;
@ApiModelProperty(value = "历年录取数据")
private List<RecommendHistoryMajorDTO> historyList;
@ApiModelProperty(value = "历年录取数据")
private Map<String,RecommendHistoryMajorDTO> historyMap;
//=============
@ApiModelProperty(value = "历年录取数据")
private List<YxHistoryMajorEnroll> historyMajorEnrollList;
@ApiModelProperty(value = "历年录取数据Map对象")
public Map<String,YxHistoryMajorEnroll> historyMajorEnrollMap;
@ -126,6 +133,11 @@ public class RecommendMajorDTO implements Serializable {
@ApiModelProperty(value = "标签")
private Set<String> tagsList;
/**
* 专业折算id
*/
@ApiModelProperty(value = "专业折算id")
private String calculationMajorId;
/**
* 考试类型(统考/校考)
*/

View File

@ -0,0 +1,107 @@
package org.jeecg.modules.web.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @author ZhouWenTao
* @create 2024-04-26-14:48
*/
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class WebMajorDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**专业名称*/
@ApiModelProperty(value = "专业名称")
private java.lang.String majorName;
/**专业代码*/
@ApiModelProperty(value = "专业代码")
private java.lang.String majorCode;
/**专业代码字母*/
@ApiModelProperty(value = "专业代码字母")
private java.lang.String majorCodeChar;
/**学历层次*/
@ApiModelProperty(value = "学历层次")
private java.lang.String educationalLevel;
/**专业图标*/
@ApiModelProperty(value = "专业图标")
private java.lang.String majorIcon;
/**学制*/
@ApiModelProperty(value = "学制")
private java.lang.String semester;
/**学科分类*/
@ApiModelProperty(value = "学科分类")
private java.lang.String xkfl;
/**专业类*/
@ApiModelProperty(value = "专业类")
private java.lang.String zyl;
/**设立日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "设立日期")
private java.util.Date establishmentDate;
/**专业描述*/
@Excel(name = "专业描述", width = 15)
@ApiModelProperty(value = "专业描述")
private java.lang.String majorDesc;
/**培养方案*/
@Excel(name = "培养方案", width = 15)
@ApiModelProperty(value = "培养方案")
private java.lang.String cultivationDirection;
/**主要课程*/
@Excel(name = "主要课程", width = 15)
@ApiModelProperty(value = "主要课程")
private java.lang.String mainCourses;
/**授予学位*/
@ApiModelProperty(value = "授予学位")
private String degree;
/**是否是职教*/
@ApiModelProperty(value = "是否是职教(1-是,0-否)")
private Integer isVte;
/**选考(学科)建议*/
@ApiModelProperty(value = "选考(学科)建议")
private String subjectAdvice;
/**第一印象*/
@ApiModelProperty(value = "第一印象")
private String firstImpression;
/**性别比例*/
@ApiModelProperty(value = "性别比例")
private String sexRatio;
/**就业率*/
@ApiModelProperty(value = "就业率")
private String employmentRate;
/**是什么*/
@ApiModelProperty(value = "是什么")
private String ssm;
/**学什么*/
@ApiModelProperty(value = "学什么")
private String xsm;
/**干什么*/
@ApiModelProperty(value = "干什么")
private String gsm;
/**就业去向*/
@ApiModelProperty(value = "就业去向")
private String employmentDestination;
/**就业地区分布*/
@ApiModelProperty(value = "就业地区分布")
private String regionDistribution;
/**就业行业分布*/
@ApiModelProperty(value = "就业行业分布")
private String industryDistribution;
/**就业岗位分布*/
@ApiModelProperty(value = "就业岗位分布")
private String jobDistribution;
}

View File

@ -0,0 +1,45 @@
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.WebMajorDTO;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.yx.mapper.YxMajorMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* 网站前台-专业Service
*
* @author ZhouWenTao
* @create 2024-04-26-14:50
*/
@Service
public class WebMajorService {
@Resource
YxMajorMapper yxMajorMapper;
/**
* 网页端-专业列表
*/
public List<JSONObject> webMajorList(QueryRecommendMajorVO queryRecommendMajorVO) {
List<JSONObject> jsonObjectList = new ArrayList<>();
List<WebMajorDTO> webMajorDtoList = yxMajorMapper.webMajorList(queryRecommendMajorVO);
if (CollectionUtils.isEmpty(webMajorDtoList)) {
return null;
}
Set<String> collect = webMajorDtoList.stream().map(WebMajorDTO::getZyl).collect(Collectors.toSet());
JSONObject js;
for (String s : collect) {
js = new JSONObject();
js.put("majorTypeName",s);
js.put("list",webMajorDtoList.stream().filter(w->w.getZyl().equals(s)).collect(Collectors.toList()));
jsonObjectList.add(js);
}
return jsonObjectList;
}
}

View File

@ -71,4 +71,6 @@ public class QueryRecommendMajorVO extends ArtBaseDTO {
@ApiModelProperty(value = "考试类型")
private String kslx;
@ApiModelProperty(value = "专业类型")
private String majorType;
}

View File

@ -12,16 +12,16 @@ import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.AssertUtils;
import org.jeecg.modules.web.dto.ArtRecommendMajorBaseDTO;
import org.jeecg.modules.web.dto.RecommendMajorDTO;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.yx.constant.YxConstant;
import org.jeecg.modules.yx.dto.UserScoreDto;
import org.jeecg.modules.yx.entity.*;
import org.jeecg.modules.yx.service.*;
import org.jeecg.modules.yx.service.impl.UserScoreService;
import org.jeecg.modules.yx.util.ScoreUtil;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -47,6 +47,8 @@ public class YxScoreController {
private IYxHistoryScoreControlLineService yxHistoryScoreControlLineService;
@Autowired
private IYxScoreSegmentService yxScoreSegmentService;
@Resource
private UserScoreService userScoreService;
@PostMapping(value = "/save")
public Result<?> save(@NotNull @RequestBody YxUserScore yxUserScore) {
@ -216,55 +218,12 @@ public class YxScoreController {
@GetMapping(value = "/getUserScoreInfo")
public Result<?> getUserScoreInfo() {
//获取分数信息
YxUserScore activeCurrentUserScore = yxUserScoreService.getActiveCurrentUserScore();
if (activeCurrentUserScore == null) {
return Result.OK();
}
//获取当前成绩下的第志愿单
LambdaQueryWrapper<YxVolunteer> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(YxVolunteer::getScoreId, activeCurrentUserScore.getId());
lambdaQueryWrapper.eq(YxVolunteer::getState, 1);
lambdaQueryWrapper.last("limit 1");
YxVolunteer yxVolunteer = yxVolunteerService.getOne(lambdaQueryWrapper);
//获取可报院校数量
QueryRecommendMajorVO queryRecommendMajorVO = new QueryRecommendMajorVO();
queryRecommendMajorVO.setBatch(activeCurrentUserScore.getBatch());
ArtRecommendMajorBaseDTO artRecommendMajorBaseDTO = new ArtRecommendMajorBaseDTO();
artRecommendMajorBaseDTO.setKbd(activeCurrentUserScore.getKbdNum());
artRecommendMajorBaseDTO.setJwt(activeCurrentUserScore.getJwtNum());
artRecommendMajorBaseDTO.setKcj(activeCurrentUserScore.getKcjNum());
artRecommendMajorBaseDTO.setNan(activeCurrentUserScore.getNlqNum());
artRecommendMajorBaseDTO.setAllNumber(activeCurrentUserScore.getKbdNum() + activeCurrentUserScore.getJwtNum() + activeCurrentUserScore.getKcjNum());
UserScoreDto userScoreDto = new UserScoreDto();
userScoreDto.setScoreInfo(activeCurrentUserScore);
userScoreDto.setVolunteer(yxVolunteer);
userScoreDto.setFillVolunteer(artRecommendMajorBaseDTO);
return Result.OK(userScoreDto);
return Result.OK(userScoreService.getActiveCurrentUserScoreInfo());
}
@ApiOperation(value = "今日编辑成绩的次数")
@GetMapping(value = "/todayOfEditScoreCount")
public Result<?> todayOfEditScoreCount() {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
JSONObject jsonObject = new JSONObject();
Date date = new Date();
String format = YxConstant.sdf.format(date);
String startTime = format + " 00:00:00";
String endTime = format + " 23:59:59";
LambdaQueryWrapper<YxUserScore> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.between(YxUserScore::getCreateTime, startTime, endTime);
lambdaQueryWrapper.eq(YxUserScore::getCreateBy, loginUser.getId());
long useCount = yxUserScoreService.count(lambdaQueryWrapper);
long residueCount = 0;
if (YxConstant.todayMaxEditScoreCount > useCount) {
//当天没有超过更改次数
residueCount = YxConstant.todayMaxEditScoreCount - useCount;
}
jsonObject.put("useCount", useCount);
jsonObject.put("residueCount", residueCount);
return Result.OK(jsonObject);
return Result.OK(userScoreService.todayOfEditScoreCount());
}
}

View File

@ -16,10 +16,10 @@ import java.io.Serializable;
*/
@Data
@ApiModel(value = "用户成绩信息dto")
public class UserScoreDto implements Serializable {
public class UserScoreDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "用户成绩信息")
private YxUserScore scoreInfo;
private UserScoreInfo scoreInfo;
@ApiModelProperty(value = "志愿单信息")
private YxVolunteer volunteer;
@ApiModelProperty(value = "推荐专业数量信息")

View File

@ -0,0 +1,121 @@
package org.jeecg.modules.yx.dto;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author ZhouWenTao
* @create 2024-04-21-15:16
*/
@Data
@ApiModel(value = "PC端用户成绩返回对象")
public class UserScoreInfo implements Serializable {
@TableId(type = IdType.ASSIGN_ID)
@JsonIgnore
private String id;
/**使用状态(0-未使用,1-使用中)*/
@ApiModelProperty(value = "使用状态(0-未使用,1-使用中,2-草表)")
private java.lang.String state;
/**填报类型(1-普通类 2-艺术类)*/
@Excel(name = "填报类型(1-普通类 2-艺术类)", width = 15)
@ApiModelProperty(value = "填报类型(1-普通类 2-艺术类)")
private java.lang.String type;
/**学历层次(1-本科,2-专科)*/
@Excel(name = "学历层次(1-本科,2-专科)", width = 15)
@ApiModelProperty(value = "学历层次(1-本科,2-专科)")
private java.lang.String educationalLevel;
/**文理分科*/
@Excel(name = "文理分科", width = 15)
@ApiModelProperty(value = "文理分科")
private java.lang.String cognitioPolyclinic;
/**专业类别(美术类/...)*/
@Excel(name = "专业类别(美术类/...)", width = 15)
@ApiModelProperty(value = "专业类别(美术类/...)")
private java.lang.String professionalCategory;
/**子级专业类别*/
@Excel(name = "子级专业类别", width = 15)
@ApiModelProperty(value = "子级专业类别")
private java.lang.String professionalCategoryChildren;
/**专业成绩分(语文,数学,英语...)*/
@Excel(name = "专业成绩分", width = 15)
@ApiModelProperty(value = "专业成绩分")
private java.math.BigDecimal professionalScore;
/**文化成绩分*/
@Excel(name = "文化成绩分", width = 15)
@ApiModelProperty(value = "文化成绩分")
private java.math.BigDecimal culturalScore;
/**创建人*/
@ApiModelProperty(value = "创建人")
@JsonIgnore
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**高考省份*/
@ApiModelProperty(value = "高考省份")
private String province;
/**录取批次*/
@ApiModelProperty(value = "录取批次")
private String batch;
/**语文成绩*/
@Excel(name = "语文成绩", width = 15)
@ApiModelProperty(value = "语文成绩")
private java.math.BigDecimal chineseScore;
/**英语成绩*/
@Excel(name = "英语成绩", width = 15)
@ApiModelProperty(value = "英语成绩")
private java.math.BigDecimal englishScore;
/**音乐表演声乐*/
@ApiModelProperty(value = "音乐表演声乐")
private BigDecimal yybysy;
/**音乐表演器乐*/
@ApiModelProperty(value = "音乐表演器乐")
private BigDecimal yybyqy;
/**音乐教育 */
@ApiModelProperty(value = "音乐教育")
private BigDecimal yyjy;
/**服装表演 */
@ApiModelProperty(value = "服装表演")
private BigDecimal fzby;
/**戏剧影视导演 */
@ApiModelProperty(value = "戏剧影视导演")
private BigDecimal xjysdy;
/**戏剧影视表演 */
@ApiModelProperty(value = "戏剧影视表演")
private BigDecimal xjysby;
@ApiModelProperty(value = "可保底专业数量")
private Integer kbdNum;
@ApiModelProperty(value = "较稳妥专业数量")
private Integer jwtNum;
@ApiModelProperty(value = "可冲击专业数量")
private Integer kcjNum;
@ApiModelProperty(value = "难录取专业数量")
private Integer nlqNum;
@ApiModelProperty(value = "记录结果表的表名")
@JsonIgnore
private String calculationTableName;
}

View File

@ -60,9 +60,9 @@ public class YxUserScore implements Serializable {
private java.lang.String professionalCategoryChildren;
/**选课*/
@Excel(name = "选课", width = 15)
/*@Excel(name = "选课", width = 15)
@ApiModelProperty(value = "选课")
private java.lang.String subjects;
private java.lang.String subjects;*/
/**专业成绩分(语文,数学,英语...)*/
@Excel(name = "专业成绩分(语文,数学,英语...)", width = 15)
@ApiModelProperty(value = "专业成绩分(语文,数学,英语...)")

View File

@ -77,6 +77,12 @@ public class YxVolunteerRecord implements Serializable {
@Excel(name = "服从调剂", width = 15)
@ApiModelProperty(value = "服从调剂")
private Integer fctj;
/**
* 专业折算id
*/
@ApiModelProperty(value = "专业折算id")
private String calculationMajorId;
//=========================
/*文理分科*/
@TableField(exist = false)

View File

@ -15,6 +15,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @Version: V1.0
*/
public interface YxCalculationMajorMapper extends BaseMapper<YxCalculationMajor> {
//本科/专科
List<RecommendMajorDTO> recommendMajorListBenOrZhuan(@Param(value = "tableName")String tableName,@Param("queryvo") QueryRecommendMajorVO queryRecommendMajorVO);
List<RecommendMajorDTO> recommendMajorList(@Param(value = "tableName")String tableName,@Param("queryvo") QueryRecommendMajorVO queryRecommendMajorVO);
void insertBatch(@Param("tableName") String tableName,@Param("list") List<YxCalculationMajor> list);

View File

@ -3,6 +3,8 @@ package org.jeecg.modules.yx.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.web.dto.WebMajorDTO;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.yx.entity.YxMajor;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -14,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface YxMajorMapper extends BaseMapper<YxMajor> {
List<WebMajorDTO> webMajorList(@Param("q") QueryRecommendMajorVO queryRecommendMajorVO);
}

View File

@ -49,4 +49,8 @@ public interface YxSchoolMapper extends BaseMapper<YxSchool> {
* @return
*/
MiniSchoolDTO getMiniDtoBySchoolCode(@Param("schoolCode") String schoolCode);
List<ArtSchoolDTO> artSchoolList1(@Param("province") String province,@Param("schoolType") String schoolType);
List<ArtSchoolDTO> artSchoolList2(@Param("province") String province,@Param("schoolType") String schoolType );
}

View File

@ -1,8 +1,7 @@
package org.jeecg.modules.yx.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.yx.dto.UserScoreInfo;
import org.jeecg.modules.yx.entity.YxUserScore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -14,4 +13,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface YxUserScoreMapper extends BaseMapper<YxUserScore> {
/**
* 根据createBy获取成绩信息state=1 1条
* @param createBy
* @return
*/
UserScoreInfo getByCreateByLast1(@Param(value = "createBy") String createBy);
}

View File

@ -20,6 +20,7 @@
<select id="recommendMajorList" resultType="org.jeecg.modules.web.dto.RecommendMajorDTO">
SELECT
cm.id,
s.school_name,
s.school_icon,
cm.school_code,
@ -41,7 +42,10 @@
cm.plan_num,
cm.main_subjects,
cm.limitation,
cm.other_score_limitation
cm.other_score_limitation,
s.province as province,
s.school_nature as schoolNature,
s.institution_type as institutionType
FROM ${tableName} cm
LEFT JOIN yx_school_child sc ON sc.school_code = cm.school_code
@ -142,7 +146,7 @@
<!--专业类别-->
<if test="queryvo.professionalCategory!=null and queryvo.professionalCategory!=''">
<!--AND fld.disciplines_name like concat('%',#{queryvo.professionalCategory},'%')-->
AND cm.major_type like concat('%',#{queryvo.professionalCategory},'%')
AND cm.major_type = #{queryvo.professionalCategory}
</if>
<!--音乐类 子项专业查询 start-->
<if test="queryvo.professionalCategory!=null and queryvo.professionalCategory=='音乐类' and queryvo.pCategoryChildrenList!=null and queryvo.pCategoryChildrenList.size>0">
@ -195,5 +199,193 @@
</if>
ORDER BY enroll_probability desc
</select>
<select id="recommendMajorListBenOrZhuan" resultType="org.jeecg.modules.web.dto.RecommendMajorDTO">
SELECT
cm.id,
s.school_name,
s.school_icon,
cm.school_code,
cm.major_code,
cm.major_name,
cm.enrollment_code,
cm.tuition,
cm.detail as majorDetail,
cm.category,
cm.batch,
cm.student_old_converted_score as studentScore,
cm.student_converted_score,
cm.enroll_probability,
cm.rules_enroll_probability,
cm.probability_operator,
cm.create_time,
cm.major_type,
cm.major_type_child,
cm.plan_num,
cm.main_subjects,
cm.limitation,
cm.other_score_limitation,
s.province as province,
s.school_nature as schoolNature,
s.institution_type as institutionType
FROM ${tableName} cm
LEFT JOIN yx_school_child sc ON sc.school_code = cm.school_code
LEFT JOIN yx_school_research_teaching srt ON srt.school_id = sc.school_id
LEFT JOIN yx_school s ON s.id = sc.school_id
WHERE 1=1
/*cm.rules_enroll_probability is not null*/
<!--成绩单-->
<if test="queryvo.scoreId!=null and queryvo.scoreId!=''">
AND cm.score_id = #{queryvo.scoreId}
</if>
<!--院校名称搜索-->
<if test="queryvo.schoolName!=null and queryvo.schoolName!=''">
AND (s.school_name like concat('%',#{queryvo.schoolName},'%') or sc.schooL_code like
concat('%',#{queryvo.schoolName},'%') or cm.major_name like
concat('%',#{queryvo.schoolName},'%'))
</if>
<if test="queryvo.schoolCode!=null and queryvo.schoolCode!=''">
AND cm.school_code = #{queryvo.schoolCode}
</if>
<!--专业编码-->
<if test="queryvo.majorCodeList!=null and queryvo.majorCodeList.size>0">
AND cm.major_code in
<foreach collection="queryvo.majorCodeList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!--地区-->
<if test="queryvo.addressList!=null and queryvo.addressList.size>0">
AND s.province in
<foreach collection="queryvo.addressList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<!--文理分科-->
<if test="queryvo.cognitioPolyclinic!=null and queryvo.cognitioPolyclinic!=''">
AND cm.category = #{queryvo.cognitioPolyclinic}
</if>
<!--批次-->
<if test="queryvo.batch!=null and queryvo.batch!=''">
<choose>
<when test="queryvo.batch=='本科' or queryvo.batch=='本科A段' or queryvo.batch=='本科B段' or queryvo.batch=='提前批'">
AND cm.batch in ('提前批','本科A段','本科B段','本科')
</when>
<when test="queryvo.batch=='高职高专'">
AND cm.batch = '高职高专'
</when>
</choose>
</if>
<if test="queryvo.batchList!=null and queryvo.batchList.size>0">
AND cm.batch in
<foreach collection="queryvo.batchList" index="index" item="b" open="(" separator="," close=")">
#{b}
</foreach>
</if>
<!--录取方式-->
<!--<if test="queryvo.rulesEnrollProbability!=null and queryvo.rulesEnrollProbability!=''">
AND cm.rules_enroll_probability_sx = #{queryvo.rulesEnrollProbability}
</if>-->
<if test="queryvo.rulesEnrollProbabilityList!=null and queryvo.rulesEnrollProbabilityList.size>0">
AND cm.rules_enroll_probability_sx in
<foreach collection="queryvo.rulesEnrollProbabilityList" index="index" item="b" open="(" separator="," close=")">
#{b}
</foreach>
</if>
<!--办学性质-->
<if test="queryvo.schoolNatureList!=null and queryvo.schoolNatureList.size>0">
AND s.school_nature in
<foreach collection="queryvo.schoolNatureList" index="index" item="b" open="(" separator="," close=")">
#{b}
</foreach>
</if>
<!--科研教学-->
<if test="queryvo.kyjxList!=null and queryvo.kyjxList.size>0">
<if test="queryvo.kyjxList.contains('硕士点')">
AND (srt.academic_master_degree_point >0 or srt.professional_master_degree_point >0)
</if>
<if test="queryvo.kyjxList.contains('博士点')">
AND srt.doctoral_point>0
</if>
<if test="queryvo.kyjxList.contains('保研')">
AND srt.byzg = 1
</if>
</if>
<!--院校标签-->
<if test="queryvo.tagsList!=null and queryvo.tagsList.size>0">
<choose>
<when test="queryvo.tagsList.contains('985') and queryvo.tagsList.contains('211')">
AND s.is985 = '1' AND s.is211 = '1'
</when>
<when test="queryvo.tagsList.contains('985')">
AND s.is985 = '1'
</when>
<when test="queryvo.tagsList.contains('211')">
AND s.is211 = '1'
</when>
<when test="queryvo.tagsList.contains('双一流')">
AND s.sfsyl !='双一流'
</when>
<otherwise>
</otherwise>
</choose>
</if>
<!--专业类别-->
<if test="queryvo.professionalCategory!=null and queryvo.professionalCategory!=''">
<!--AND fld.disciplines_name like concat('%',#{queryvo.professionalCategory},'%')-->
AND cm.major_type = #{queryvo.professionalCategory}
</if>
<!--音乐类 子项专业查询 start-->
<if test="queryvo.professionalCategory!=null and queryvo.professionalCategory=='音乐类' and queryvo.pCategoryChildrenList!=null and queryvo.pCategoryChildrenList.size>0">
AND(
<choose>
<when test="queryvo.pCategoryChildrenList.contains('音乐表演声乐')">
cm.main_subjects like '%声乐%'
<!--AND (
cm.major_type_child = '音乐表演'
<if test="queryvo.pCategoryChildrenList.contains('音乐教育')">
or cm.major_type_child = '音乐教育'
</if>
)-->
</when>
<when test="queryvo.pCategoryChildrenList.contains('音乐表演器乐')">
cm.main_subjects like '%器乐%'
<!--AND (
cm.major_type_child = '音乐表演'
<if test="queryvo.pCategoryChildrenList.contains('音乐教育')">
or cm.major_type_child = '音乐教育'
</if>
)-->
</when>
<when test="queryvo.pCategoryChildrenList.contains('音乐教育')">
cm.major_type_child = '音乐教育'
</when>
</choose>
)
</if>
<!--音乐类 子项专业查询 end-->
<!--表演类 子项专业查询 start-->
<if test="queryvo.professionalCategory!=null and queryvo.professionalCategory=='表演类' and queryvo.pCategoryChildrenList!=null and queryvo.pCategoryChildrenList.size>0">
AND cm.main_subjects in
<foreach collection="queryvo.pCategoryChildrenList" index="index" item="b" open="(" separator="," close=")">
#{b}
</foreach>
</if>
<!--表演类 子项专业查询 end-->
<!--院校类型-->
<if test="queryvo.institutionType!=null and queryvo.institutionType!=''">
AND s.institution_type= #{queryvo.institutionType}
</if>
<!--办学性质-->
<if test="queryvo.schoolNature!=null and queryvo.schoolNature!=''">
AND s.school_nature= #{queryvo.schoolNature}
</if>
<if test="queryvo.kslx!=null and queryvo.kslx!=''">
AND cm.kslx = #{queryvo.kslx}
</if>
ORDER BY enroll_probability DESC
</select>
</mapper>

View File

@ -2,4 +2,27 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.yx.mapper.YxMajorMapper">
</mapper>
<select id="webMajorList" resultType="org.jeecg.modules.web.dto.WebMajorDTO">
SELECT id,
major_name,
degree,
semester,
sex_ratio,
major_code,
zyl,
educational_level
FROM yx_major
<where>
AND major_name not like '%类' AND zyl is not null
<if test="q.majorName!=null and q.majorName!=''">
AND major_name like concat('%',#{q.majorName},'%')
</if>
<if test="q.educationalLevel!=null and q.educationalLevel!=''">
AND educational_level like #{q.educationalLevel}
</if>
<if test="q.majorType!=null and q.majorType!=''">
AND zyl = #{q.majorType}
</if>
</where>
</select>
</mapper>

View File

@ -423,4 +423,64 @@
WHERE s.school_name = #{schoolName} or sc.school_name = #{schoolName}
limit 1
</select>
<select id="artSchoolList1" resultType="org.jeecg.modules.web.dto.ArtSchoolDTO">
SELECT
sc.school_name,
sc.school_code,
s.id,
s.school_icon,
s.school_nature,
s.institution_type,
s.school_type,
s.province,
s.city,
s.area,
s.street,
IFNULL(s.is211,"0") as is211,
IFNULL(s.is985,"0") as is985,
s.sfsyl,
s.sjyl,
s.gzsz,
s.gjtszy,
s.gzd,
s.yldx,
s.byl,
s.stszy,
s.is_strengthen,
s.tags
FROM yx_school_child sc
LEFT JOIN yx_school s ON sc.school_id = s.id
WHERE s.province = #{province} AND s.school_type = #{schoolType}
LIMIT 0,10
</select>
<select id="artSchoolList2" resultType="org.jeecg.modules.web.dto.ArtSchoolDTO">
SELECT
sc.school_name,
sc.school_code,
s.id,
s.school_icon,
s.school_nature,
s.institution_type,
s.school_type,
s.province,
s.city,
s.area,
s.street,
IFNULL(s.is211,"0") as is211,
IFNULL(s.is985,"0") as is985,
s.sfsyl,
s.sjyl,
s.gzsz,
s.gjtszy,
s.gzd,
s.yldx,
s.byl,
s.stszy,
s.is_strengthen,
s.tags
FROM yx_school_child sc
LEFT JOIN yx_school s ON sc.school_id = s.id
WHERE s.province != #{province} AND s.school_type = #{schoolType}
LIMIT 0,10
</select>
</mapper>

View File

@ -2,4 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.yx.mapper.YxUserScoreMapper">
</mapper>
<select id="getByCreateByLast1" resultType="org.jeecg.modules.yx.dto.UserScoreInfo">
SELECT * FROM yx_user_score WHERE create_by = #{createBy} AND state = 1
limit 0,1
</select>
</mapper>

View File

@ -93,8 +93,10 @@
s.province as province,
s.school_nature as propertyName,
s.institution_type as institutionType,
cm.id as calculationMajorId,
cm.major_name,
cm.category,
cm.plan_num as planNum,
cm.rules_enroll_probability as rulesEnrollProbability,
cm.probability_operator as probabilityOperator,
cm.detail as majorDetail,

View File

@ -34,5 +34,4 @@ public interface IYxVolunteerRecordService extends IService<YxVolunteerRecord> {
*/
boolean deleteByVolunteerId(String volunteerId);
}

View File

@ -1,9 +1,11 @@
package org.jeecg.modules.yx.service;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.web.vo.SaveVolunteerVO;
import org.jeecg.modules.yx.dto.VolunteerDTO;
import org.jeecg.modules.yx.entity.YxVolunteer;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.yx.entity.YxVolunteerRecord;
import java.util.List;
@ -14,6 +16,8 @@ import java.util.List;
* @Version: V1.0
*/
public interface IYxVolunteerService extends IService<YxVolunteer> {
/**
* 根据创建人获取 使用中 的志愿单
* @param createBy 创建人
@ -60,4 +64,16 @@ public interface IYxVolunteerService extends IService<YxVolunteer> {
* @param userId 用户id,不传就是所有用户
*/
void removeOldScore(String userId);
/**
* 批量添加志愿信息
*/
Result<?> saveVolunteerBatch(List<YxVolunteerRecord> volunteerRecordList);
/**
* 根据 志愿明细id删除志愿
*/
Result<?> deleteVolunteerRecordBatch(List<String> volunteerRecordIdList);
}

View File

@ -0,0 +1,151 @@
package org.jeecg.modules.yx.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.collections.CollectionUtils;
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.modules.web.dto.ArtRecommendMajorBaseDTO;
import org.jeecg.modules.yx.constant.YxConstant;
import org.jeecg.modules.yx.dto.UserScoreInfo;
import org.jeecg.modules.yx.dto.UserScoreDTO;
import org.jeecg.modules.yx.entity.YxUserScore;
import org.jeecg.modules.yx.entity.YxVolunteer;
import org.jeecg.modules.yx.mapper.YxUserScoreMapper;
import org.jeecg.modules.yx.mapper.YxVolunteerMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 通用-用户分数Service
*
* @author ZhouWenTao
* @create 2024-04-21-15:48
*/
@Service
public class UserScoreService {
@Resource
private YxUserScoreMapper yxUserScoreMapper;
@Resource
private YxVolunteerMapper yxVolunteerMapper;
/**
* 获取当前用户的分数成绩一些列信息
*/
public UserScoreDTO getActiveCurrentUserScoreInfo() {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
AssertUtils.notNull(loginUser, "请先登录!");
try {
//获取用户
UserScoreInfo userScoreInfo = this.getActiveUserScore(loginUser.getId());
if (userScoreInfo == null) {
return null;
}
UserScoreDTO userScoreDto = new UserScoreDTO();
//获取 志愿单信息
LambdaQueryWrapper<YxVolunteer> yxVolunteerLambdaQueryWrapper = new LambdaQueryWrapper<>();
yxVolunteerLambdaQueryWrapper.eq(YxVolunteer::getScoreId, userScoreInfo.getId());
yxVolunteerLambdaQueryWrapper.eq(YxVolunteer::getState, 1);
yxVolunteerLambdaQueryWrapper.last("limit 1");
YxVolunteer yxVolunteer = yxVolunteerMapper.selectOne(yxVolunteerLambdaQueryWrapper);
//组合参数
userScoreDto.setScoreInfo(userScoreInfo);
if (yxVolunteer != null) {
userScoreDto.setVolunteer(yxVolunteer);
}
//获取 可报院校数量
userScoreDto.setFillVolunteer(new ArtRecommendMajorBaseDTO(userScoreInfo.getKbdNum(), userScoreInfo.getJwtNum(), userScoreInfo.getKcjNum(), userScoreInfo.getNlqNum()));
return userScoreDto;
} catch (Exception e) {
return null;
}
}
/**
* 根据createBy获取使用成绩
*/
public UserScoreInfo getActiveUserScore(String createBy) {
if (StringUtils.isBlank(createBy)) {
return null;
}
return yxUserScoreMapper.getByCreateByLast1(createBy);
}
/**
* 获取当前用户今天剩余可保存成绩次数
*/
public JSONObject todayOfEditScoreCount() {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
AssertUtils.notNull(loginUser, "请先登录!");
JSONObject jsonObject = new JSONObject();
Date date = new Date();
String format = YxConstant.sdf.format(date);
String startTime = format + " 00:00:00";
String endTime = format + " 23:59:59";
LambdaQueryWrapper<YxUserScore> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.between(YxUserScore::getCreateTime, startTime, endTime);
lambdaQueryWrapper.eq(YxUserScore::getCreateBy, loginUser.getId());
long useCount = yxUserScoreMapper.selectCount(lambdaQueryWrapper);
long residueCount = 0;
if (YxConstant.todayMaxEditScoreCount > useCount) {
//当天没有超过更改次数
residueCount = YxConstant.todayMaxEditScoreCount - useCount;
}
jsonObject.put("useCount", useCount);
jsonObject.put("residueCount", residueCount);
return jsonObject;
}
/**
* 获取用户的成绩志愿单列表
*/
public List<UserScoreDTO> volunteerListUser(String userId) {
if (StringUtils.isBlank(userId)) {
//如果没穿userId则是查当前用户否则根据userId查询
LoginUser loginUser=(LoginUser) SecurityUtils.getSubject().getPrincipal();
userId = loginUser.getId();
}
LambdaQueryWrapper<YxUserScore> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(YxUserScore::getCreateBy,userId);
lambdaQueryWrapper.in(YxUserScore::getState,"0","1");
lambdaQueryWrapper.orderByDesc(YxUserScore::getState,YxUserScore::getCreateTime);
//获取成绩列表
List<YxUserScore> list = yxUserScoreMapper.selectList(lambdaQueryWrapper);
List<UserScoreDTO> resultDataList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(list)) {
//获取志愿表信息
List<String> userScoreIdList = list.stream().map(YxUserScore::getId).collect(Collectors.toList());
List<YxVolunteer> volunteerList = yxVolunteerMapper.selectList(new LambdaQueryWrapper<YxVolunteer>().in(YxVolunteer::getScoreId, userScoreIdList));
UserScoreDTO userScoreDto = null;
UserScoreInfo usi = null;
YxVolunteer yxVolunteer = null;
for (YxUserScore yxUserScore : list) {
try {
//返回对象
userScoreDto = new UserScoreDTO();
//成绩信息
usi = new UserScoreInfo();
BeanUtils.copyProperties(yxUserScore,usi);
userScoreDto.setScoreInfo(usi);
//志愿表信息
yxVolunteer = volunteerList.stream().filter(v -> v.getScoreId().equals(yxUserScore.getId())).findAny().get();
userScoreDto.setVolunteer(yxVolunteer);
//add到集合
resultDataList.add(userScoreDto);
}catch (Exception e){
continue;
}
}
}
return resultDataList;
}
}

View File

@ -292,9 +292,9 @@ public class YxCalculationMajorServiceImpl extends ServiceImpl<YxCalculationMajo
public ArtRecommendMajorBaseDTO aiAutoRecommendMajor(QueryRecommendMajorVO queryRecommendMajorVO) {
String batch = queryRecommendMajorVO.getBatch();
int pageNum = 1;
int pageSize = 12;
int pageSize = 35;
if ("提前批".equals(batch)) {
pageSize = 2;
pageSize = 1;
}
YxUserScore activeCurrentUserScore = null;
if (StringUtils.isNotBlank(queryRecommendMajorVO.getScoreId())) {
@ -325,7 +325,7 @@ public class YxCalculationMajorServiceImpl extends ServiceImpl<YxCalculationMajo
queryRecommendMajorVO.setAddressList(Arrays.asList(queryRecommendMajorVO.getProvince().split(",")));
}
queryRecommendMajorVO.setScoreId(activeCurrentUserScore.getId());
List<RecommendMajorDTO> recommendMajorList = baseMapper.recommendMajorList(activeCurrentUserScore.getCalculationTableName(),queryRecommendMajorVO);
List<RecommendMajorDTO> recommendMajorList = baseMapper.recommendMajorListBenOrZhuan(activeCurrentUserScore.getCalculationTableName(),queryRecommendMajorVO);
yxHistoryMajorEnrollService.recommendMajorDTOListSetHistoryInfo(recommendMajorList);

View File

@ -286,161 +286,121 @@ public class YxSchoolServiceImpl extends ServiceImpl<YxSchoolMapper, YxSchool> i
@Override
public ArtHotSchoolDTO hotList() {
ArtHotSchoolDTO artHotSchoolDTO = new ArtHotSchoolDTO();
//获取当前省份的学校
//获取本科
String province = "河南";
LambdaQueryWrapper<YxSchool> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(YxSchool::getProvince, province);
queryWrapper.eq(YxSchool::getSchoolType, "本科");
queryWrapper.last("limit 0,10");
List<YxSchool> nowProvinceBenSchoolList = this.list(queryWrapper);
//获取高职高专
queryWrapper.clear();
queryWrapper.eq(YxSchool::getProvince, province);
queryWrapper.eq(YxSchool::getSchoolType, "专科");
queryWrapper.last("limit 0,10");
List<YxSchool> nowProvinceZhuanSchoolList = this.list(queryWrapper);
List<ArtSchoolDTO> nowProvinceBenSchoolList = baseMapper.artSchoolList1(province,"本科");
List<ArtSchoolDTO> nowProvinceZhuanSchoolList = baseMapper.artSchoolList1(province,"专科");
//获取外省的学校
//获取本科
queryWrapper.clear();
queryWrapper.ne(YxSchool::getProvince, province);
queryWrapper.eq(YxSchool::getSchoolType, "本科");
queryWrapper.last("limit 0,10");
List<YxSchool> otherProvinceBenSchoolList = this.list(queryWrapper);
//获取专科
queryWrapper.clear();
queryWrapper.ne(YxSchool::getProvince, province);
queryWrapper.eq(YxSchool::getSchoolType, "专科");
queryWrapper.last("limit 0,10");
List<YxSchool> otherProvinceZhuanSchoolList = this.list(queryWrapper);
List<ArtSchoolDTO> otherProvinceBenSchoolList = baseMapper.artSchoolList2(province,"本科");
List<ArtSchoolDTO> otherProvinceZhuanSchoolList = baseMapper.artSchoolList2(province,"专科");
//处理标签
Set<String> tagsList;
List<String> list985211 = Arrays.asList("211", "985");
String tags = null;
List<ArtSchoolDTO> artSchoolDTOList = new ArrayList<>();
ArtSchoolDTO artSchoolDTO = null;
for (YxSchool record : nowProvinceBenSchoolList) {
artSchoolDTO = new ArtSchoolDTO();
for (ArtSchoolDTO artSchoolDTO : nowProvinceBenSchoolList) {
tagsList = new LinkedHashSet<>();
//处理 标签字符串转 array
tags = record.getTags();
tags = artSchoolDTO.getTags();
if (StringUtils.isNotEmpty(tags)) {
tagsList = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(tags.split(","))));
}
tagsList.add(record.getSchoolType());//学校层次
tagsList.add(record.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(record.getInstitutionType())) {
tagsList.add(record.getInstitutionType() + "");//院校类型
tagsList.add(artSchoolDTO.getSchoolType());//学校层次
tagsList.add(artSchoolDTO.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(artSchoolDTO.getInstitutionType())) {
tagsList.add(artSchoolDTO.getInstitutionType() + "");//院校类型
}
//判断 是否是 985,211
if (record.getIs211().equals(1)) {
if (artSchoolDTO.getIs211().equals("1")) {
tagsList.add("211");
}
if (record.getIs985().equals(1)) {
if (artSchoolDTO.getIs985().equals("1")) {
tagsList.add("985");
}
if (tagsList.containsAll(list985211)) {
tagsList.add("双一流");
}
BeanUtils.copyProperties(record, artSchoolDTO);
artSchoolDTO.setTagsList(tagsList);
artSchoolDTOList.add(artSchoolDTO);
}
artHotSchoolDTO.setNowProvinceBenSchoolList(artSchoolDTOList);
artSchoolDTOList = new ArrayList<>();
for (YxSchool record : nowProvinceZhuanSchoolList) {
artSchoolDTO = new ArtSchoolDTO();
for (ArtSchoolDTO artSchoolDTO : nowProvinceZhuanSchoolList) {
tagsList = new LinkedHashSet<>();
//处理 标签字符串转 array
tags = record.getTags();
tags = artSchoolDTO.getTags();
if (StringUtils.isNotEmpty(tags)) {
tagsList = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(tags.split(","))));
}
tagsList.add(record.getSchoolType());//学校层次
tagsList.add(record.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(record.getInstitutionType())) {
tagsList.add(record.getInstitutionType() + "");//院校类型
tagsList.add(artSchoolDTO.getSchoolType());//学校层次
tagsList.add(artSchoolDTO.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(artSchoolDTO.getInstitutionType())) {
tagsList.add(artSchoolDTO.getInstitutionType() + "");//院校类型
}
//判断 是否是 985,211
if (record.getIs211().equals(1)) {
if (artSchoolDTO.getIs211().equals("1")) {
tagsList.add("211");
}
if (record.getIs985().equals(1)) {
if (artSchoolDTO.getIs985().equals("1")) {
tagsList.add("985");
}
if (tagsList.containsAll(list985211)) {
tagsList.add("双一流");
}
BeanUtils.copyProperties(record, artSchoolDTO);
artSchoolDTO.setTagsList(tagsList);
artSchoolDTOList.add(artSchoolDTO);
}
artHotSchoolDTO.setNowProvinceZhuanSchoolList(artSchoolDTOList);
artSchoolDTOList = new ArrayList<>();
for (YxSchool record : otherProvinceBenSchoolList) {
artSchoolDTO = new ArtSchoolDTO();
for (ArtSchoolDTO artSchoolDTO : otherProvinceBenSchoolList) {
tagsList = new LinkedHashSet<>();
//处理 标签字符串转 array
tags = record.getTags();
tags = artSchoolDTO.getTags();
if (StringUtils.isNotEmpty(tags)) {
tagsList = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(tags.split(","))));
}
tagsList.add(record.getSchoolType());//学校层次
tagsList.add(record.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(record.getInstitutionType())) {
tagsList.add(record.getInstitutionType() + "");//院校类型
tagsList.add(artSchoolDTO.getSchoolType());//学校层次
tagsList.add(artSchoolDTO.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(artSchoolDTO.getInstitutionType())) {
tagsList.add(artSchoolDTO.getInstitutionType() + "");//院校类型
}
//判断 是否是 985,211
if (record.getIs211().equals(1)) {
if (artSchoolDTO.getIs211().equals("1")) {
tagsList.add("211");
}
if (record.getIs985().equals(1)) {
if (artSchoolDTO.getIs985().equals("1")) {
tagsList.add("985");
}
if (tagsList.containsAll(list985211)) {
tagsList.add("双一流");
}
BeanUtils.copyProperties(record, artSchoolDTO);
artSchoolDTO.setTagsList(tagsList);
artSchoolDTOList.add(artSchoolDTO);
}
artHotSchoolDTO.setOtherProvinceBenSchoolList(artSchoolDTOList);
artSchoolDTOList = new ArrayList<>();
for (YxSchool record : otherProvinceZhuanSchoolList) {
artSchoolDTO = new ArtSchoolDTO();
for (ArtSchoolDTO artSchoolDTO : otherProvinceZhuanSchoolList) {
tagsList = new LinkedHashSet<>();
//处理 标签字符串转 array
tags = record.getTags();
tags = artSchoolDTO.getTags();
if (StringUtils.isNotEmpty(tags)) {
tagsList = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(tags.split(","))));
}
tagsList.add(record.getSchoolType());//学校层次
tagsList.add(record.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(record.getInstitutionType())) {
tagsList.add(record.getInstitutionType() + "");//院校类型
tagsList.add(artSchoolDTO.getSchoolType());//学校层次
tagsList.add(artSchoolDTO.getSchoolNature());//办学性质
if (StringUtils.isNotBlank(artSchoolDTO.getInstitutionType())) {
tagsList.add(artSchoolDTO.getInstitutionType() + "");//院校类型
}
//判断 是否是 985,211
if (record.getIs211().equals(1)) {
if (artSchoolDTO.getIs211().equals("1")) {
tagsList.add("211");
}
if (record.getIs985().equals(1)) {
if (artSchoolDTO.getIs985().equals("1")) {
tagsList.add("985");
}
if (tagsList.containsAll(list985211)) {
tagsList.add("双一流");
}
BeanUtils.copyProperties(record, artSchoolDTO);
artSchoolDTO.setTagsList(tagsList);
artSchoolDTOList.add(artSchoolDTO);
}
artHotSchoolDTO.setOtherProvinceZhuanSchoolList(artSchoolDTOList);
artHotSchoolDTO.setNowProvinceBenSchoolList(nowProvinceBenSchoolList);
artHotSchoolDTO.setNowProvinceZhuanSchoolList(nowProvinceZhuanSchoolList);
artHotSchoolDTO.setOtherProvinceBenSchoolList(otherProvinceBenSchoolList);
artHotSchoolDTO.setOtherProvinceZhuanSchoolList(otherProvinceZhuanSchoolList);
return artHotSchoolDTO;
}
}

View File

@ -1,6 +1,8 @@
package org.jeecg.modules.yx.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.AssertUtils;
import org.jeecg.modules.web.vo.SaveVolunteerVO;
import org.jeecg.modules.yx.constant.YxConstant;
@ -82,11 +84,11 @@ public class YxVolunteerRecordServiceImpl extends ServiceImpl<YxVolunteerRecordM
String key = majorCode+schoolCode+enrollmentCode+category;
//判断这个批次段的是否已填满
long count = list.stream().filter(l -> !(l.getMajorCode()+l.getSchoolCode()+l.getEnrollmentCode()+l.getCategory()).equals(key)).count();
if ("体育类".equals(majorType)) {
AssertUtils.notTrue(count>=12,batch+"仅可以填报十二个志愿");
}else{
AssertUtils.notTrue(count>=35,batch+"仅可以填报三十五个志愿");
}
// if ("体育类".equals(majorType)) {
// AssertUtils.notTrue(count>=35,batch+"仅可以填报三十五个志愿");
// }else{
// }
AssertUtils.notTrue(count>=35,batch+"仅可以填报三十五个志愿");
}else if(YxConstant.batchList1.contains(batch)){
//本科批
yxVolunteerRecordLambdaQueryWrapper.in(YxVolunteerRecord::getBatch,YxConstant.batchList1);
@ -95,11 +97,7 @@ public class YxVolunteerRecordServiceImpl extends ServiceImpl<YxVolunteerRecordM
String key = majorCode+schoolCode+enrollmentCode+category;
//判断这个批次段的是否已填满
long count = list.stream().filter(l -> !(l.getMajorCode()+l.getSchoolCode()+l.getEnrollmentCode()+l.getCategory()).equals(key)).count();
if ("体育类".equals(majorType)) {
AssertUtils.notTrue(count>=12,batch+"仅可以填报十二个志愿");
}else{
AssertUtils.notTrue(count>=35,batch+"仅可以填报三十五个志愿");
}
AssertUtils.notTrue(count>=35,batch+"仅可以填报三十五个志愿");
}
//循环已填报专业与当前专业对比是否一致
@ -159,4 +157,5 @@ public class YxVolunteerRecordServiceImpl extends ServiceImpl<YxVolunteerRecordM
public boolean deleteByVolunteerId(String volunteerId) {
return this.remove(new LambdaQueryWrapper<YxVolunteerRecord>().eq(YxVolunteerRecord::getVolunteerId,volunteerId));
}
}

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.AssertUtils;
@ -16,10 +17,12 @@ import org.jeecg.modules.yx.dto.VolunteerDTO;
import org.jeecg.modules.yx.dto.VolunteerRecordDTO;
import org.jeecg.modules.yx.entity.*;
import org.jeecg.modules.yx.mapper.YxVolunteerMapper;
import org.jeecg.modules.yx.mapper.YxVolunteerRecordMapper;
import org.jeecg.modules.yx.service.*;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
@ -43,9 +46,12 @@ public class YxVolunteerServiceImpl extends ServiceImpl<YxVolunteerMapper, YxVol
private IYxVolunteerRecordService yxVolunteerRecordService;
@Resource
private IYxHistoryMajorEnrollService yxHistoryMajorEnrollService;
@Resource
private YxVolunteerRecordMapper yxVolunteerRecordMapper;
final static BigDecimal bigDecimal100 = new BigDecimal("100");//100倍率
@Override
public VolunteerDTO getActiveByCreate(String createBy) {
VolunteerDTO volunteerDTO = new VolunteerDTO();
@ -318,7 +324,10 @@ public class YxVolunteerServiceImpl extends ServiceImpl<YxVolunteerMapper, YxVol
}
@Override
@Transactional(rollbackFor = Exception.class)
public String saveAs(SaveVolunteerVO saveVolunteerVO) {
VolunteerDTO activeByCreate = getActiveByCreate(saveVolunteerVO.getCreateBy());
saveVolunteerVO.setScoreId(activeByCreate.getScoreId());
List<SaveVolunteerRecordVO> volunteerRecordList = saveVolunteerVO.getVolunteerRecordList();
//先保存一个志愿单
String volunteerName = saveVolunteerVO.getVolunteerName();
@ -326,7 +335,7 @@ public class YxVolunteerServiceImpl extends ServiceImpl<YxVolunteerMapper, YxVol
if (count > 0) {
throw new JeecgBootException("志愿单名称已存在!请更换");
}
AssertUtils.notNull(volunteerName, "请输入志愿单名称");
AssertUtils.notEmpty(volunteerName, "请输入志愿单名称");
//将之前的成绩单状态改为0再复制一份新的成绩单
yxUserScoreService.closeStatus(saveVolunteerVO.getScoreId());
YxUserScore newUserScore = yxUserScoreService.copyById(saveVolunteerVO.getScoreId());
@ -427,4 +436,69 @@ public class YxVolunteerServiceImpl extends ServiceImpl<YxVolunteerMapper, YxVol
}
}
@Override
public Result<?> saveVolunteerBatch(List<YxVolunteerRecord> volunteerRecordList) {
try {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
VolunteerDTO activeByCreateVolunteerDto = getActiveByCreate(loginUser.getId());
//如果有志愿单时才可以添加志愿明细
if (activeByCreateVolunteerDto!=null && StringUtils.isNotBlank(activeByCreateVolunteerDto.getId())) {
String volunteerId = activeByCreateVolunteerDto.getId();
YxCalculationMajor calculationMajor = null;
for (YxVolunteerRecord yxVolunteerRecord : volunteerRecordList) {
//判断有没有专业Id
if (StringUtils.isBlank(yxVolunteerRecord.getCalculationMajorId())) {
continue;
}
calculationMajor = yxCalculationMajorService.getById(yxVolunteerRecord.getCalculationMajorId());
if (calculationMajor == null) {
continue;
}
yxVolunteerRecord.setCreateBy(loginUser.getId());
yxVolunteerRecord.setVolunteerId(volunteerId);
yxVolunteerRecord.setBatch(calculationMajor.getBatch());
yxVolunteerRecord.setCategory(calculationMajor.getCategory());
yxVolunteerRecord.setFctj(1);
yxVolunteerRecord.setEnrollmentCode(calculationMajor.getEnrollmentCode());
yxVolunteerRecord.setEnrollProbability(calculationMajor.getEnrollProbability());
yxVolunteerRecord.setMajorCode(calculationMajor.getMajorCode());
yxVolunteerRecord.setSchoolCode(calculationMajor.getSchoolCode());
yxVolunteerRecord.setStudentConvertedScore(calculationMajor.getStudentConvertedScore());
}
}
//过滤没有专业id的数据,然后保存数据里
volunteerRecordList = volunteerRecordList.stream().filter(v->StringUtils.isNotBlank(v.getCalculationMajorId())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(volunteerRecordList)) {
yxVolunteerRecordService.saveBatch(volunteerRecordList);
}
return Result.OK("保存成功");
}catch (Exception e){
return Result.error(e.getMessage());
}
}
@Override
public Result<?> deleteVolunteerRecordBatch(List<String> volunteerRecordIdList) {
try {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (CollectionUtils.isEmpty(volunteerRecordIdList)) {
throw new RuntimeException("请求参数有误");
}
//根据当前用户id获取他的志愿单
VolunteerDTO activeByCreateVolunteerDto = getActiveByCreate(loginUser.getId());
if (activeByCreateVolunteerDto!=null) {
//根据志愿单id+删除的志愿明细id删除
String id = activeByCreateVolunteerDto.getId();
LambdaQueryWrapper<YxVolunteerRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(YxVolunteerRecord::getVolunteerId,id);
lambdaQueryWrapper.in(YxVolunteerRecord::getId,volunteerRecordIdList);
//List<YxVolunteerRecord> volunteerRecordList = yxVolunteerRecordMapper.selectList(lambdaQueryWrapper);
yxVolunteerRecordMapper.delete(lambdaQueryWrapper);
}
return Result.OK("删除成功");
}catch (Exception e){
return Result.error(e.getMessage());
}
}
}