导入接口,导入表格接口
This commit is contained in:
parent
d09c8e13d8
commit
afa290ba7c
|
@ -77,6 +77,8 @@ public class ShiroConfig {
|
|||
}
|
||||
// 2024.3.26 黄晖添加
|
||||
|
||||
// 2024.10.23 林利弘添加
|
||||
// filterChainDefinitionMap.put("/cetDataImport/cas/client/validateLogin", "anon"); //cas验证登录
|
||||
|
||||
|
||||
// 配置不会被拦截的链接 顺序判断
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
package org.jeecg.modules.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.service.CetDataImport;
|
||||
import org.jeecg.modules.utils.Base64DecodedMultipartFile;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
|
@ -39,7 +44,21 @@ public class CetDataImportController {
|
|||
**/
|
||||
@RequestMapping("dbfImport")
|
||||
@ApiOperation("DBF数据导入")
|
||||
public Result<?> DBFImport(@RequestParam("file") MultipartFile file, @RequestParam("batch") String batch, @RequestParam("level") String level) {
|
||||
public Result<?> DBFImport(@RequestBody JSONObject jsonObject) {
|
||||
byte[] fileBytes;
|
||||
String batch = jsonObject.getString("batch");
|
||||
String fileName = (String) jsonObject.get("fileName");
|
||||
String level = jsonObject.getString("level");
|
||||
String fileContent = jsonObject.getString("fileContent");
|
||||
try {
|
||||
// 移除 data URL 前缀
|
||||
String base64Data = fileContent.split(",")[1];
|
||||
fileBytes = Base64.getDecoder().decode(base64Data);
|
||||
} catch (Exception e) {
|
||||
return Result.error("文件解码失败");
|
||||
}
|
||||
MultipartFile file = new Base64DecodedMultipartFile(fileBytes, fileName);
|
||||
|
||||
return cetDataImport.readDBF(file, batch, level);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,128 +25,126 @@ import io.swagger.annotations.ApiOperation;
|
|||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Description: cet_4
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-03-26
|
||||
* @Date: 2024-03-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="cet_4")
|
||||
@Api(tags = "cet_4")
|
||||
@RestController
|
||||
@RequestMapping("/cet_4")
|
||||
@Slf4j
|
||||
public class Cet_4Controller extends JeecgController<Cet_4, ICet_4Service> {
|
||||
@Autowired
|
||||
private ICet_4Service cet_4Service;
|
||||
@Autowired
|
||||
private ICet_4Service cet_4Service;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param cet_4
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet_4-分页列表查询")
|
||||
@ApiOperation(value="cet_4-分页列表查询", notes="cet_4-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Cet_4>> queryPageList(Cet_4 cet_4,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<Cet_4> queryWrapper = QueryGenerator.initQueryWrapper(cet_4, req.getParameterMap());
|
||||
Page<Cet_4> page = new Page<Cet_4>(pageNo, pageSize);
|
||||
IPage<Cet_4> pageList = cet_4Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cet_4
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-添加")
|
||||
@ApiOperation(value="cet_4-添加", notes="cet_4-添加")
|
||||
@RequiresPermissions("cet:cet_4:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Cet_4 cet_4) {
|
||||
cet_4Service.save(cet_4);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cet_4
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-编辑")
|
||||
@ApiOperation(value="cet_4-编辑", notes="cet_4-编辑")
|
||||
@RequiresPermissions("cet:cet_4:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Cet_4 cet_4) {
|
||||
cet_4Service.updateById(cet_4);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-通过id删除")
|
||||
@ApiOperation(value="cet_4-通过id删除", notes="cet_4-通过id删除")
|
||||
@RequiresPermissions("cet:cet_4:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
cet_4Service.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-批量删除")
|
||||
@ApiOperation(value="cet_4-批量删除", notes="cet_4-批量删除")
|
||||
@RequiresPermissions("cet:cet_4:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.cet_4Service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet_4-通过id查询")
|
||||
@ApiOperation(value="cet_4-通过id查询", notes="cet_4-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Cet_4> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Cet_4 cet_4 = cet_4Service.getById(id);
|
||||
if(cet_4==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(cet_4);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param cet_4
|
||||
*/
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param cet_4
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet_4-分页列表查询")
|
||||
@ApiOperation(value = "cet_4-分页列表查询", notes = "cet_4-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Cet_4>> queryPageList(Cet_4 cet_4,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<Cet_4> queryWrapper = QueryGenerator.initQueryWrapper(cet_4, req.getParameterMap());
|
||||
Page<Cet_4> page = new Page<Cet_4>(pageNo, pageSize);
|
||||
IPage<Cet_4> pageList = cet_4Service.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cet_4
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-添加")
|
||||
@ApiOperation(value = "cet_4-添加", notes = "cet_4-添加")
|
||||
@RequiresPermissions("cet:cet_4:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Cet_4 cet_4) {
|
||||
cet_4Service.save(cet_4);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cet_4
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-编辑")
|
||||
@ApiOperation(value = "cet_4-编辑", notes = "cet_4-编辑")
|
||||
@RequiresPermissions("cet:cet_4:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Cet_4 cet_4) {
|
||||
cet_4Service.updateById(cet_4);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-通过id删除")
|
||||
@ApiOperation(value = "cet_4-通过id删除", notes = "cet_4-通过id删除")
|
||||
@RequiresPermissions("cet:cet_4:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
cet_4Service.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "cet_4-批量删除")
|
||||
@ApiOperation(value = "cet_4-批量删除", notes = "cet_4-批量删除")
|
||||
@RequiresPermissions("cet:cet_4:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.cet_4Service.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "cet_4-通过id查询")
|
||||
@ApiOperation(value = "cet_4-通过id查询", notes = "cet_4-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Cet_4> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Cet_4 cet_4 = cet_4Service.getById(id);
|
||||
if (cet_4 == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(cet_4);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param cet_4
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_4:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Cet_4 cet_4) {
|
||||
|
@ -154,24 +152,30 @@ public class Cet_4Controller extends JeecgController<Cet_4, ICet_4Service> {
|
|||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("cet:cet_4:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, Cet_4.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 依据学生id和姓名获取四级成绩
|
||||
*/
|
||||
@RequestMapping("/getDataByStudent")
|
||||
public Result<JSONObject> getDataByStudent(@RequestBody JSONObject jsonObject){
|
||||
return cet_4Service.getDataByStudent(jsonObject);
|
||||
}
|
||||
/**
|
||||
* 依据学生id和姓名获取四级成绩
|
||||
*/
|
||||
@RequestMapping("/getDataByStudent")
|
||||
public Result<JSONObject> getDataByStudent(@RequestBody JSONObject jsonObject) {
|
||||
return cet_4Service.getDataByStudent(jsonObject);
|
||||
}
|
||||
|
||||
@RequestMapping("loadImportDataList")
|
||||
public Result<JSONObject> loadImportDataList() {
|
||||
return cet_4Service.loadImportDataList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Arrays;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.entity.Cet_6;
|
||||
|
@ -167,4 +168,9 @@ public class Cet_6Controller extends JeecgController<Cet_6, ICet_6Service> {
|
|||
return cet_6Service.getGrateRate();
|
||||
}
|
||||
|
||||
@RequestMapping("loadImportDataList")
|
||||
public Result<JSONObject> loadImportDataList() {
|
||||
return cet_6Service.loadImportDataList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ import org.jeecg.modules.entity.Cet_4;
|
|||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @Description: cet_6
|
||||
|
@ -28,4 +30,6 @@ public interface CenterService extends IService<Cet_4> {
|
|||
Result<JSONObject> getCollegeMajor();
|
||||
|
||||
List<String> getEntryDateByBatch(Date batch);
|
||||
|
||||
<T,R> Map<Object, Long> dealList(List<T> list, Function<T,R> mapper);
|
||||
}
|
||||
|
|
|
@ -131,7 +131,6 @@ public class CetDataImport {
|
|||
cet4List.add(cet4);
|
||||
}
|
||||
if (cet4List.size() >= 500) {
|
||||
cet4Service.save(cet4);
|
||||
cet4Service.saveBatch(cet4List);
|
||||
log.info("Cet学生{}", cet4);
|
||||
cet4List.clear();
|
||||
|
@ -141,7 +140,6 @@ public class CetDataImport {
|
|||
cet6List.add(cet6);
|
||||
}
|
||||
if (cet6List.size() >= 500) {
|
||||
cet6Service.save(cet6);
|
||||
cet6Service.saveBatch(cet6List);
|
||||
cet6List.clear();
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ import org.jeecg.modules.entity.Cet_4;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: cet_4
|
||||
|
@ -35,4 +37,7 @@ public interface ICet_4Service extends IService<Cet_4> {
|
|||
Result<JSONObject> getRateByMajorAndLastestBatch(getRateByMajorAndLastestBatchDto getRateByMajorAndLastestBatchParam);
|
||||
|
||||
Result<JSONObject> getRateByEntryDate(getRateByEntryDateDto getRateByEntryDateDtoParams);
|
||||
|
||||
Result<JSONObject> loadImportDataList();
|
||||
List<JSONObject> getJsonObjects(Map<Object, Long> map);
|
||||
}
|
||||
|
|
|
@ -16,4 +16,6 @@ public interface ICet_6Service extends IService<Cet_6> {
|
|||
Result<JSONObject> getRate(Cet_6 data);
|
||||
|
||||
Result<?> getGrateRate();
|
||||
Result<JSONObject> loadImportDataList();
|
||||
|
||||
}
|
||||
|
|
|
@ -130,6 +130,12 @@ public class CenterServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implement
|
|||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T, R> Map<Object, Long> dealList(List<T> list, Function<T, R> mapper) {
|
||||
return list.stream().collect(Collectors.groupingBy(mapper,Collectors.counting()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统计四级表和六级表中存在的批次
|
||||
*/
|
||||
|
|
|
@ -17,6 +17,8 @@ import org.jeecg.modules.mapper.Cet_4Mapper;
|
|||
import org.jeecg.modules.service.CenterService;
|
||||
import org.jeecg.modules.service.CetCleanService;
|
||||
import org.jeecg.modules.service.ICet_4Service;
|
||||
import org.jeecg.modules.utils.DateUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -170,7 +172,7 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
for (Map.Entry<String, Object> stringObjectEntry : list) {
|
||||
jsonObject.put(stringObjectEntry.getKey(), stringObjectEntry.getValue());
|
||||
}
|
||||
JSONObject gradeByBatch = getGradeByBatch(batch,college);
|
||||
JSONObject gradeByBatch = getGradeByBatch(batch, college);
|
||||
resultData.put("data", jsonObject);
|
||||
resultData.put("gradeData", gradeByBatch);
|
||||
System.out.println(resultData);
|
||||
|
@ -671,6 +673,32 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
return Result.ok(result);
|
||||
}
|
||||
|
||||
@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);
|
||||
return Result.ok(new JSONObject().fluentPut("data", res));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<JSONObject> getJsonObjects(Map<Object, Long> map) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
// res按照batch倒序排序
|
||||
res.sort((o1, o2) -> o2.getString("batch").compareTo(o1.getString("batch")));
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 依据学生id和姓名获取四级数据
|
||||
*/
|
||||
|
@ -691,11 +719,11 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getGradeByBatch(Date batch,String college) {
|
||||
public JSONObject getGradeByBatch(Date batch, String college) {
|
||||
//根据批次获取正确的年级
|
||||
List<String> trueEntryDate = centerService.getEntryDateByBatch(batch);
|
||||
LambdaQueryWrapper<Cet_4> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(!college.equals("全校"),Cet_4::getCollege,college)
|
||||
wrapper.eq(!college.equals("全校"), Cet_4::getCollege, college)
|
||||
.eq(Cet_4::getBatch, batch);
|
||||
List<Cet_4> allStudent = list(wrapper);
|
||||
wrapper.ge(Cet_4::getResult, 425);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.modules.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
@ -9,17 +10,17 @@ import org.jeecg.modules.entity.Cet4_major;
|
|||
import org.jeecg.modules.entity.Cet_4;
|
||||
import org.jeecg.modules.entity.Cet_6;
|
||||
import org.jeecg.modules.mapper.Cet_6Mapper;
|
||||
import org.jeecg.modules.service.CenterService;
|
||||
import org.jeecg.modules.service.ICet_6Service;
|
||||
import org.jeecg.modules.utils.DateUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.Set;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -38,6 +39,8 @@ public class Cet_6ServiceImpl extends ServiceImpl<Cet_6Mapper, Cet_6> implements
|
|||
@Autowired
|
||||
Cet_4ServiceImpl cet4Service;
|
||||
@Autowired
|
||||
CenterService centerService;
|
||||
@Autowired
|
||||
CetMajorServiceImpl cetMajorService;
|
||||
|
||||
@Override
|
||||
|
@ -105,6 +108,14 @@ public class Cet_6ServiceImpl extends ServiceImpl<Cet_6Mapper, Cet_6> implements
|
|||
return null;
|
||||
}
|
||||
|
||||
@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);
|
||||
return Result.ok(new JSONObject().fluentPut("data", res));
|
||||
}
|
||||
|
||||
|
||||
private long getNum(Cet_6 cet) {
|
||||
LambdaQueryWrapper<Cet_6> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package org.jeecg.modules.utils;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Author: Cool
|
||||
* @Date: 2024/10/23/17:16
|
||||
* @Description:
|
||||
*/
|
||||
public class Base64DecodedMultipartFile implements MultipartFile {
|
||||
|
||||
private final byte[] fileContent;
|
||||
private final String header;
|
||||
|
||||
public Base64DecodedMultipartFile(byte[] fileContent, String header) {
|
||||
this.fileContent = fileContent;
|
||||
this.header = header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// 返回文件名
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOriginalFilename() {
|
||||
// 返回文件名
|
||||
return header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
// 返回文件类型
|
||||
return "application/octet-stream";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return fileContent == null || fileContent.length == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return fileContent.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytes() throws IOException {
|
||||
return fileContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return new ByteArrayInputStream(fileContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferTo(File dest) throws IOException, IllegalStateException {
|
||||
Files.write(dest.toPath(), fileContent);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue