这个作业属于哪个课程 | 2301-计算机学院-软件工程社区-CSDN社区云 |
---|---|
这个作业要求在哪里 | 团队作业——站立式会议+alpha冲刺-CSDN社区 |
这个作业的目标 | 记录alpha冲刺Day8 |
团队名称 | 熬夜会秃头 |
团队置顶集合随笔链接 | Alpha 冲刺随笔置顶(熬夜会秃头团队)-CSDN博客 |
一、团队成员站立式会议总结
组员 | 昨天站立式会议到现在的进展 | 存在的问题/遇到的困难 | 今天到明天会议的安排 | 心得体会 |
陈少桐 | 完善了验证码发送的倒计时、完成了文件上传界面的跟上传图片的逻辑编写 | 引入uview-plus配置环境会一直报错,显示缺少头文件 解决:在main.js里面引入import uviewPlus from '@/uni_modules/uview-plus' | 梳理功能的逻辑关系,编写缺少的页面以及子窗体 | 发现利用uview-plus的组件库开发会节省下很多的时间,比起自己判断逻辑去编写标签栏,利用组件库会来得更加美观和便捷。 |
梁菲汎 | 实现了各页面之间的点击跳转 | 无 | 完善前端功能 | 首先需要对按钮绑定一个函数,然后在函数里进行页面路由的改变。 这里要确保项目中已经在使用vue-router。 |
陈知菲 | 实现文件的分片上传功能、数据去重功能 | 存储分片文件时,每存储一个分片,要打开并写入新文件,,再进行整合,效率低下 解决:使用RandomAccessFile,支持随机访问,程序可以直接跳转到文件的任意地方来读写数据,故对于传入的分片,只要打开文件一次,改变指针的位置写入分片,就可以得到完整的文件 对于文件名不同、内容相同的文件,如何实现去重 解决:使用MD5算法,对文件内容进行md5加密,只要其内容完全相同,生成的md5值是一样的,由此可实现文件的去重,以及校验文件在传输过程中是否出现错误 | 分片上传接口的优化、实现高并发的文件修改 | 在实现分片上传逻辑和实现文件校验的过程中,对文件的存取方式和文件去重的方法MD5有了进一步的了解 |
李恒欣 | 完善后端功能 | 无 | 继续完善后端功能 | 后端功能的实现离不开数据结构的设计,一个好的数据结构可以提高代码的可读性和可维护性,同时也有利于提高程序的性能。 |
邱思源 | 对新实现的后端代码进行单元测试 | 后端代码较为复杂,编写和执行单元测试需要较长时间 | 继续进行单元测试并加深学习前后端交互功能知识 | 可以通过编写自动化测试脚本、优化测试用例等方式提高单元测试的效率。 |
宋芳鑫 | 学习Vue CLI并完善前端功能 | 遇到兼容性问题 | 继续完善前端交互功能 | 通过使用模板、插件等功能,可以快速搭建项目结构,提高开发效率。 |
张一凡 | 对新实现的前端代码进行单元测试 | 前端代码通常需要考虑用户的输入和操作,而这些行为很难在单元测试中进行模拟 | 继续进行单元测试并加深学习前后端交互功能知识 | 通过比较组件在不同状态下的渲染结果,可以确保组件的功能正确性。这种方法不需要关心组件的内部实现,只需关注其输出结果。 |
林承桢 | 对新完成的功能进行测试,将测试结果写入测试文档 | 无 | 继续进行功能测试,完善测试文档 | 编写测试文档需要对测试结果进行详细的分析和解释,以便项目团队能够更好地了解问题的原因和解决方案。 |
黄才栋 | 了解如何使用 Webpack 和 NPM 进行项目的构建和管理并完善前端功能 | Webpack 构建速度慢、打包体积过大 | 继续完善前端交互功能 | Webpack 和 NPM 会不断更新和改进,因此需要持续关注官方文档和社区动态,了解最新的功能和使用方法。同时,也要关注其他前端技术和框架的发展,以便更好地应对实际开发中的挑战。 |
谢怀广 | 核对已完成代码规范并制作项目燃尽图 | 对后端代码的理解不够 | 核对新增代码规范并制作项目燃尽图 | 仍需对代码进行学习理解,以便更好地核对代码规范。 |
二、今日成果展示
<button class="container2-2" @click="getCode" :disabled="btnDis">{{btnText}}</button>
countDown() {
let t = null;
let timer = 60;
this.btnDis = true;
clearInterval(t);
this.btnText = `${timer}s`;
t = setInterval(() => {
if (timer == 0) {
clearInterval(t);
this.btnText = "重新发送";
this.btnDis = false;
return;
}
timer--;
this.btnText = `${timer}s`;
}, 1000)
},
各页面间的点击跳转
export default {
name :'login',
setup()
{
...
const jump = () =>{
router.push({path:'/register'})
}
return {jump}
}
}
文件分片上传接口
上传准备->分片上传->上传结束,开始整合
@PostMapping("/shardPreparation")
public Result shardPreparation(@RequestParam String fileName,
@RequestParam Integer shardNum,
@RequestParam Long shardSize,
@RequestParam String bucketId,
@RequestParam Boolean isZip,
@RequestParam String originMd5,
@RequestHeader(value = "from", required = false) String from) {
System.out.println(from);
ShardMessage message =
new ShardMessage(fileName, shardNum, shardSize, bucketId, isZip, new HashSet<>(), null);
if (from != null || ClusterProperty.cluster) {
return putService.shardPreparation(message, originMd5);
} else {
return cPutService.shardPreparation(message, originMd5);
}
}
@PostMapping("/uploadShard")
public Result<Integer> uploadShard(@RequestParam Integer no,
@RequestParam String totalMd5,
@RequestParam String ownMd5,
@RequestParam MultipartFile file,
@RequestParam String key,
@RequestHeader(value = "from", required = false) String from) {
System.out.println(from);
ShardFile shardFile = new ShardFile(no, totalMd5, ownMd5, file);
if (from != null || !ClusterProperty.cluster) {
return putService.uploadShard(shardFile);
} else {
return cPutService.uploadShard(shardFile, key);
}
}
@PostMapping("/checkShard")
public Result<Set<Integer>> checkShard(@RequestParam String md5,
@RequestParam String key,
@RequestHeader(value = "from", required = false) String from) {
System.out.println(from);
if (from != null || !ClusterProperty.cluster) {
return putService.checkShard(md5);
} else {
return cPutService.checkShard(md5, key);
}
}
分片接收逻辑(内存中保存已上传的分片信息,以便后续的检查)
Override
public Result<Integer> uploadShard(ShardFile shardFile) {
String totalMD5 = shardFile.getTotalMD5();
ShardMessage message = ShardMessage.getInstance().get(totalMD5);
if (message == null) {
return new Result<>(404, "文件信息不存在", -1);
}
if (message.getShardSet().contains(shardFile.getNo())) {
return new Result<>(205, "分片已上传过", -1);
}
if (!FileUtil.getMd5(shardFile.getFile()).equals(shardFile.getOwnMD5())) {
return new Result<>(400, "文件传输有误", -1);
}
if (shardFile.getNo() >= message.getShardNum()) {
return new Result<>(200, "传的是什么鬼");
}
if (!FileUtil.uploadShard(shardFile)) {
return new Result<>(500, "上传失败", -1);
}
message.getShardSet().add(shardFile.getNo());
return new Result<>(200, "上传成功", shardFile.getNo());
}
分片文件的整合(使用RandomAccessFile对文件位置的随机读写功能,将分片按序号写入)
public static Boolean uploadShard(ShardFile file) {
ShardMessage message = ShardMessage.getInstance().get(file.getTotalMD5());
String path = FileProperty.realPath
+ message.getBucketId() + "/" + message.getFileName() + ".temp";
File toFile = new File(path);
if (!toFile.exists()) {
try {
toFile.createNewFile();
toFile.setWritable(true, false);
toFile.setReadable(true, false);
toFile.setExecutable(true, false);
} catch (IOException e) {
e.printStackTrace();
}
}
RandomAccessFile accessFile = null;
try {
accessFile = new RandomAccessFile(path, "rw");
long offset = message.getShardSize() * file.getNo();
accessFile.seek(offset);
accessFile.write(file.getFile().getBytes());
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
} finally {
try {
assert accessFile != null;
accessFile.close();
} catch (IOException e) {
e.printStackTrace();
}
}