Merge remote-tracking branch 'refs/remotes/upstream/dev' into dev
This commit is contained in:
commit
519a3dc0f8
|
@ -2,6 +2,7 @@ package org.jeecg.modules.service;
|
|||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.dto.getRateByEntryDateDto;
|
||||
import org.jeecg.modules.dto.getRateByMajorAndLastestBatchDto;
|
||||
|
@ -15,7 +16,7 @@ import java.util.Map;
|
|||
/**
|
||||
* @Description: cet_4
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-03-26
|
||||
* @Date: 2024-03-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ICet_4Service extends IService<Cet_4> {
|
||||
|
@ -31,7 +32,8 @@ public interface ICet_4Service extends IService<Cet_4> {
|
|||
|
||||
Result<JSONObject> getDataByStudent(JSONObject jsonObject);
|
||||
|
||||
JSONObject getGradeByBatch(Date batch,String college);
|
||||
JSONObject getGradeByBatch(Date batch, String college);
|
||||
|
||||
boolean cleanData();
|
||||
|
||||
Result<JSONObject> getRateByMajorAndLastestBatch(getRateByMajorAndLastestBatchDto getRateByMajorAndLastestBatchParam);
|
||||
|
@ -39,5 +41,6 @@ public interface ICet_4Service extends IService<Cet_4> {
|
|||
Result<JSONObject> getRateByEntryDate(getRateByEntryDateDto getRateByEntryDateDtoParams);
|
||||
|
||||
Result<JSONObject> loadImportDataList();
|
||||
List<JSONObject> getJsonObjects(Map<Object, Long> map);
|
||||
|
||||
List<JSONObject> getJsonObjects(List<Map<String, Object>> list);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.dto.getRateByEntryDateDto;
|
||||
|
@ -626,26 +627,27 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
|
||||
@Override
|
||||
public Result<JSONObject> loadImportDataList() {
|
||||
List<Cet_4> list = list();
|
||||
Map<Object, Long> map = centerService.dealList(list, Cet_4::getBatch);
|
||||
List<JSONObject> res = getJsonObjects(map);
|
||||
// 创建 QueryWrapper
|
||||
QueryWrapper<Cet_4> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("batch", "COUNT(*) AS count")
|
||||
.groupBy("batch");
|
||||
|
||||
// 执行查询,获取结果列表
|
||||
List<Map<String, Object>> list = this.listMaps(queryWrapper);
|
||||
List<JSONObject> res = getJsonObjects(list);
|
||||
return Result.ok(new JSONObject().fluentPut("data", res));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<JSONObject> getJsonObjects(Map<Object, Long> map) {
|
||||
@Override
|
||||
public List<JSONObject> getJsonObjects(List<Map<String, Object>> list) {
|
||||
List<JSONObject> res = new ArrayList<>();
|
||||
if (map != null && !map.isEmpty()) {
|
||||
for (Map.Entry<Object, Long> entry : map.entrySet()) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
//格式化key为"yyyy-MM-dd"
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
jsonObject.fluentPut("batch", sdf.format(entry.getKey()))
|
||||
.fluentPut("attendNumber", entry.getValue());
|
||||
res.add(jsonObject);
|
||||
}
|
||||
for (Map<String, Object> map : list) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("batch", map.get("batch"));
|
||||
jsonObject.put("attendNumber", map.get("count"));
|
||||
res.add(jsonObject);
|
||||
}
|
||||
// res按照batch倒序排序
|
||||
res.sort((o1, o2) -> o2.getString("batch").compareTo(o1.getString("batch")));
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ 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 lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.entity.Cet4_major;
|
||||
|
@ -110,9 +111,14 @@ public class Cet_6ServiceImpl extends ServiceImpl<Cet_6Mapper, Cet_6> implements
|
|||
|
||||
@Override
|
||||
public Result<JSONObject> loadImportDataList() {
|
||||
List<Cet_6> list = list();
|
||||
Map<Object, Long> map = centerService.dealList(list, Cet_6::getBatch);
|
||||
List<JSONObject> res =cet4Service.getJsonObjects(map);
|
||||
// 创建 QueryWrapper
|
||||
QueryWrapper<Cet_6> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("batch", "COUNT(*) AS count")
|
||||
.groupBy("batch");
|
||||
|
||||
// 执行查询,获取结果列表
|
||||
List<Map<String, Object>> list = this.listMaps(queryWrapper);
|
||||
List<JSONObject> res = cet4Service.getJsonObjects(list);
|
||||
return Result.ok(new JSONObject().fluentPut("data", res));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue