Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # jeecg-module-system/jeecg-system-start/src/main/java/org/jeecg/modules/controller/CenterController.java
This commit is contained in:
commit
5a5e9d4acd
|
@ -54,7 +54,7 @@ public class DBFImporter {
|
||||||
//对学生信息进行检查
|
//对学生信息进行检查
|
||||||
int entry = Integer.parseInt(entryDate);
|
int entry = Integer.parseInt(entryDate);
|
||||||
int year = DateUtils.getYear();
|
int year = DateUtils.getYear();
|
||||||
if (entry<2015||entry>year+1||Pattern.compile("[a-zA-Z]").matcher(entryDate).find()) continue;
|
if (entry<2010||entry>year+1||Pattern.compile("[a-zA-Z]").matcher(entryDate).find()) continue;
|
||||||
|
|
||||||
cet.setEntrydate(entryDate.substring(0, 4));
|
cet.setEntrydate(entryDate.substring(0, 4));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
package org.jeecg.modules.service;
|
package org.jeecg.modules.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.modules.entity.Cet_4;
|
import org.jeecg.modules.entity.Cet_4;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.modules.entity.Cet_6;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: cet_4
|
* @Description: cet_4
|
||||||
|
@ -10,5 +17,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
public interface ICet_4Service extends IService<Cet_4> {
|
public interface ICet_4Service extends IService<Cet_4> {
|
||||||
|
public Result<JSONObject> getRate(Cet_4 cet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
package org.jeecg.modules.service;
|
package org.jeecg.modules.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.modules.entity.Cet_6;
|
import org.jeecg.modules.entity.Cet_6;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: cet_6
|
* @Description: cet_6
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
|
@ -10,5 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
public interface ICet_6Service extends IService<Cet_6> {
|
public interface ICet_6Service extends IService<Cet_6> {
|
||||||
|
public Result<JSONObject> getRate(Cet_6 data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,23 @@
|
||||||
package org.jeecg.modules.service.impl;
|
package org.jeecg.modules.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
|
||||||
|
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.modules.entity.Cet_4;
|
import org.jeecg.modules.entity.Cet_4;
|
||||||
import org.jeecg.modules.mapper.Cet_4Mapper;
|
import org.jeecg.modules.mapper.Cet_4Mapper;
|
||||||
import org.jeecg.modules.service.ICet_4Service;
|
import org.jeecg.modules.service.ICet_4Service;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: cet_4
|
* @Description: cet_4
|
||||||
|
@ -15,5 +27,58 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements ICet_4Service {
|
public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements ICet_4Service {
|
||||||
|
@Autowired
|
||||||
|
Cet_4Mapper cet4Mapper;
|
||||||
|
|
||||||
|
public Result<JSONObject> getRate(Cet_4 cet) {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
//select count(*) from cet_4 where college ='?' and result>=425
|
||||||
|
LambdaQueryWrapper<Cet_4> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
//构造查询条件
|
||||||
|
if (cet.getBatch() == null) {
|
||||||
|
//根据学院查人数
|
||||||
|
queryWrapper.eq(Cet_4::getCollege, cet.getCollege()).ge(Cet_4::getResult, 425);
|
||||||
|
List<Cet_4> result = cet4Mapper.selectList(queryWrapper);
|
||||||
|
Map<String, List<Cet_4>> collect = result.stream().collect(Collectors.groupingBy(Cet_4::getCollege));
|
||||||
|
for (Map.Entry<String, List<Cet_4>> entry : collect.entrySet()) {
|
||||||
|
double sum = (double) getNum(cet);
|
||||||
|
double size = entry.getValue().size();
|
||||||
|
double passRate = sum / size;
|
||||||
|
jsonObject.put(String.valueOf(entry.getKey()),
|
||||||
|
passRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.OK(jsonObject);
|
||||||
|
|
||||||
|
} else if (cet.getCollege() == null) {
|
||||||
|
//根据批次查人数
|
||||||
|
queryWrapper.eq(Cet_4::getBatch, cet.getBatch()).ge(Cet_4::getResult, 425);
|
||||||
|
List<Cet_4> result = cet4Mapper.selectList(queryWrapper);
|
||||||
|
Map<Date, List<Cet_4>> collect = result.stream().collect(Collectors.groupingBy(Cet_4::getBatch));
|
||||||
|
for (Map.Entry<Date, List<Cet_4>> entry : collect.entrySet()) {
|
||||||
|
double sum = (double) getNum(cet);
|
||||||
|
double size = entry.getValue().size();
|
||||||
|
double passRate = sum / size;
|
||||||
|
jsonObject.put(String.valueOf(entry.getKey()),
|
||||||
|
passRate);
|
||||||
|
}
|
||||||
|
return Result.OK(jsonObject);
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private long getNum(Cet_4 cet) {
|
||||||
|
LambdaQueryWrapper<Cet_4> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (cet.getCollege() == null) {
|
||||||
|
queryWrapper.eq(Cet_4::getBatch, cet.getBatch());
|
||||||
|
}
|
||||||
|
if (cet.getBatch() == null) {
|
||||||
|
queryWrapper.eq(Cet_4::getCollege, cet.getCollege());
|
||||||
|
}
|
||||||
|
return cet4Mapper.selectCount(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package org.jeecg.modules.service.impl;
|
package org.jeecg.modules.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.modules.entity.Cet_6;
|
import org.jeecg.modules.entity.Cet_6;
|
||||||
import org.jeecg.modules.mapper.Cet_6Mapper;
|
import org.jeecg.modules.mapper.Cet_6Mapper;
|
||||||
import org.jeecg.modules.service.ICet_6Service;
|
import org.jeecg.modules.service.ICet_6Service;
|
||||||
|
@ -7,6 +12,12 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: cet_6
|
* @Description: cet_6
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
|
@ -15,5 +26,58 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class Cet_6ServiceImpl extends ServiceImpl<Cet_6Mapper, Cet_6> implements ICet_6Service {
|
public class Cet_6ServiceImpl extends ServiceImpl<Cet_6Mapper, Cet_6> implements ICet_6Service {
|
||||||
|
@Resource
|
||||||
|
Cet_6Mapper cet6Mapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<JSONObject> getRate(Cet_6 cet) {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
//select count(*) from cet_6 where college ='?' and result>=425
|
||||||
|
LambdaQueryWrapper<Cet_6> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
//构造查询条件
|
||||||
|
if (cet.getBatch() == null) {
|
||||||
|
//根据学院查人数
|
||||||
|
queryWrapper.eq(Cet_6::getCollege, cet.getCollege()).ge(Cet_6::getResult, 425);
|
||||||
|
List<Cet_6> result = cet6Mapper.selectList(queryWrapper);
|
||||||
|
Map<String, List<Cet_6>> collect = result.stream().collect(Collectors.groupingBy(Cet_6::getCollege));
|
||||||
|
for (Map.Entry<String, List<Cet_6>> entry : collect.entrySet()) {
|
||||||
|
double sum = (double) getNum(cet);
|
||||||
|
double size = entry.getValue().size();
|
||||||
|
double passRate = sum / size;
|
||||||
|
jsonObject.put(String.valueOf(entry.getKey()),
|
||||||
|
passRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.OK(jsonObject);
|
||||||
|
|
||||||
|
} else if (cet.getCollege() == null) {
|
||||||
|
//根据批次查人数
|
||||||
|
queryWrapper.eq(Cet_6::getBatch, cet.getBatch()).ge(Cet_6::getResult, 425);
|
||||||
|
List<Cet_6> result = cet6Mapper.selectList(queryWrapper);
|
||||||
|
Map<Date, List<Cet_6>> collect = result.stream().collect(Collectors.groupingBy(Cet_6::getBatch));
|
||||||
|
for (Map.Entry<Date, List<Cet_6>> entry : collect.entrySet()) {
|
||||||
|
double sum = (double) getNum(cet);
|
||||||
|
double size = entry.getValue().size();
|
||||||
|
double passRate = sum / size;
|
||||||
|
jsonObject.put(String.valueOf(entry.getKey()),
|
||||||
|
passRate);
|
||||||
|
}
|
||||||
|
return Result.OK(jsonObject);
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private long getNum(Cet_6 cet) {
|
||||||
|
LambdaQueryWrapper<Cet_6> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (cet.getCollege() == null) {
|
||||||
|
queryWrapper.eq(Cet_6::getBatch, cet.getBatch());
|
||||||
|
}
|
||||||
|
if (cet.getBatch() == null) {
|
||||||
|
queryWrapper.eq(Cet_6::getCollege, cet.getCollege());
|
||||||
|
}
|
||||||
|
return cet6Mapper.selectCount(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue