package com.example.service.AdminService.AdminServiceImpl;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONObject;
import com.example.dao.AdminDao.AdminDao;
import com.example.dao.topicDao.ChapterDao;
import com.example.dao.topicDao.DayExerciseDao;
import com.example.dao.topicDao.PracticeTestDao;
import com.example.dao.vedioDao.VedioDao;
import com.example.enumConfig.Monikaoshi;
import com.example.pojo.Admin;
import com.example.pojo.Book;
import com.example.pojo.BookSection;
import com.example.pojo.Practice;
import com.example.pojo.Section;
import com.example.pojo.T_Area;
import com.example.pojo.T_File;
import com.example.pojo.T_examination;
import com.example.pojo.T_topic;
import com.example.pojo.T_user;
import com.example.pojo.Vedio;
import com.example.pojo.t_mistakes;
import com.example.service.AdminService.AdminService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
@Service
public class AdminServiceImpl implements AdminService {
@Autowired
AdminDao ad;
@Autowired
VedioDao vd;
@Autowired
ChapterDao cd;
@Autowired
ChapterDao chapterDao;
@Autowired
PracticeTestDao pd;
@Autowired
DayExerciseDao dd;
List<Integer> his = new ArrayList<Integer>();
Map<String, List<T_topic>> map = new HashMap<String, List<T_topic>>();
public boolean adminLogin(String username, String password) {
List<Admin> a = ad.adminLogin(new Admin(username, password));
if (a.size() > 0) {
return true;
} else {
return false;
}
}
public List<T_File> fileList() {
List<T_File> list = ad.fileList();
List<T_File> list2 = new ArrayList<T_File>();
for (T_File t_File : list) {
if (t_File.getStatus().equals("1")) {
t_File.setStatus("单选题");
} else if (t_File.getStatus().equals("2")) {
t_File.setStatus("判断题");
} else {
t_File.setStatus("多选题");
}
list2.add(t_File);
}
return list2;
}
public synchronized int fileUpload(MultipartFile file, HttpServletRequest servletRequest, String id) {
//多选题
StringBuilder buffer = new StringBuilder();
int i;
int j = 0;
Sheet sheet;
Workbook book;
Cell cell1, cell2, cell3, cell4, cell5, cell6 = null, cell7 = null, cell8 = null;
String path = servletRequest.getSession().getServletContext().getRealPath("/upload");
// 上传文件名
String name = file.getOriginalFilename();// 上传文件的真实名称
File filepath = new File(path, name);
// 判断路径是否存在,没有就创建一个
if (!filepath.getParentFile().exists()) {
filepath.getParentFile().mkdirs();
}
// 将上传文件保存到一个目标文档中
File tempFile = new File(path + File.separator + name);
try {
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String time = format.format(date);
file.transferTo(tempFile);
// filepath为要读取的excel文件名
book = Workbook.getWorkbook(filepath);
// 获得第一个工作表对象(ecxel中sheet的编号从0开始,0,1,2,3,....)
sheet = book.getSheet(0);
// 获取左上角的单元格
cell1 = sheet.getCell(0, 0);
i = 1;
boolean falg = false;
int ifFileClass = 0; // 1为单选题。2为多选题。3为判断题
for (int k = 1; k < sheet.getRows(); k++) {
System.out.println("行数" + sheet.getColumns());
T_topic topic;
if (sheet.getColumns() == 7) {// 单选题
ifFileClass = 1;
// 获取每一行的单元格
cell1 = sheet.getCell(0, k);// (列,行)
cell2 = sheet.getCell(1, k);
cell3 = sheet.getCell(2, k);
cell4 = sheet.getCell(3, k);
cell5 = sheet.getCell(4, k);
cell6 = sheet.getCell(5, k);
cell7 = sheet.getCell(6, k);
topic = new T_topic(cell1.getContents(), cell2.getContents(), cell3.getContents(),
cell4.getContents(), cell5.getContents(), cell6.getContents(), cell7.getContents(), "1");
if (id != null) {
topic.setSid(Integer.parseInt(id));
}
j = ad.insertTopic(topic);
Integer tid = ad.maxTidList();
} else if (sheet.getColumns() >= 8) {// 多选题
ifFileClass = 3;
// 获取每一行的单元格
cell1 = sheet.getCell(0, k);// (列,行)
cell2 = sheet.getCell(1, k);
cell3 = sheet.getCell(2, k);
cell4 = sheet.getCell(3, k);
cell5 = sheet.getCell(4, k);
cell6 = sheet.getCell(5, k);
cell7 = sheet.getCell(6, k);
cell8 = sheet.getCell(7, k);
try {
if (cell7.getContents().equals("") || cell7.getContents().equals(null)) {
topic = new T_topic(cell1.getContents(), cell2.getContents(), cell3.getContents(),
cell4.getContents(), cell5.getContents(), cell6.getContents(), cell8.getContents(),
"1");
if (id != null) {
topic.setSid(Integer.parseInt(id));
}
j = ad.insertTopic(topic);
Integer tid = ad.maxTidList();
} else {
String contents = cell2.getContents().replaceAll(",", "").replaceAll(" ", "")
.replaceAll(",", "");
char[] split = contents.toCharArray();
for (int ii = 0; ii < split.length; ii++) {
if (ii < split.length - 1) {
buffer.append(split[ii] + ",");
} else {
buffer.append(split[ii]);
}
}
topic = new T_topic(cell1.getContents(), buffer.toString(), cell3.getContents(),
cell4.getContents(), cell5.getContents(), cell6.getContents(), cell7.getContents(),
cell8.getContents(), "3");
buffer.delete(0, buffer.length());
System.out.println(topic);
System.out.println("传过来的id" + id);
if (id != null) {
topic.setSid(Integer.parseInt(id));
}
j = ad.insertTopic(topic);
Integer tid = ad.maxTidList();
}
} catch (NullPointerException e) {
topic = new T_topic(cell1.getContents(), cell2.getContents(), cell3.getContents(),
cell4.getContents(), cell5.getContents(), cell6.getContents(), cell8.getContents(),
"1");
if (id != null) {
topic.setSid(Integer.parseInt(id));
}
j = ad.insertTopic(topic);
Integer tid = ad.maxTidList();
}
} else {// 判断题
ifFileClass = 2;
// 获取每一行的单元格
cell1 = sheet.getCell(0, k);// (列,行)
cell2 = sheet.getCell(1, k);
cell3 = sheet.getCell(2, k);
falg = true;
topic = new T_topic(cell1.getContents(), cell2.getContents().toUpperCase(), cell3.getContents(),
"2");
if (id != null) {
topic.setSid(Integer.parseInt(id));
}
j = ad.insertTopic(topic);
Integer tid = ad.maxTidList();
}
if ("".equals(cell1.getContents()) == true) // 如果读取的数据为空
break;
}
if (ifFileClass == 2) {
T_File t_File = new T_File(name, "2", time, path);
j = ad.insertFile(t_File);
} else if (ifFileClass == 1) {
T_File t_File = new T_File(name, "1", time, path);
j = ad.insertFile(t_File);
} else if (ifFileClass == 3) {
T_File t_File = new T_File(name, "3", time, path);
j = ad.insertFile(t_File);
}
book.close();
} catch
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
这是一个在线的一个学习平台,有答题,测试,考试,练习等等功能,还有上传视频,可以通过微信小程序在线观看视频进行学习,支持购买会员,会员分为三个等级(等级内容自己定),这个项目由微信小程序+java+mysql组成,后端框架用的springboot,管理端框架使用的layui,压缩包里面有运行截图(内含数据库mysql),项目下载后可以直接运行
资源推荐
资源详情
资源评论
收起资源包目录
在线学习微信小程序.zip (1739个子文件)
02add20b581be471b8d17f887b8e8337070546 194B
04dbb931da38197af918734bd3d39784e0749d 490B
04dd412ac38058a99cf37ea76830e5f0f27b24 52B
082918dfcc5b628a31141e48425aef8305517f 3KB
090e360f2ed96bc59e9bbaea213c0d79e40e8f 1KB
0967c9374764f6d2a99d4a6a93567863ed5de5 3KB
0b1250fbb60d56e1405b157145c15be7b24380 518B
0b88ab89256c52400fbd47b28a8df4f5bd245c 180B
1045e5435fe75add31d199729a6833aa7296dc 1KB
161a743eb0976780472c1a1ecd55b5b8b2e1ea 883B
16440253c69d1b0a477ef49a6b9b9efe22ba4a 29KB
18d2bbdf97bc5dba0962aacfa65e8222e24000 828B
18ec4476cc512be6b0303ac88ed4f75bd028f8 378B
1ae30631904970ffd7f9aa770ed5b738b118ed 5KB
1afe02bce44cce0fd4322d9562c1781aa70d8a 2KB
1ec23bc1770e1cbd37a8f37653bd79e193752e 800B
1eef4677a360afeba67a518b53b8685c1d3a9d 655B
22d5570ccc661a0d8993d086ef7a4bb6d0b093 268KB
2756d698151f4615d6225c90d3c28e1407456b 3KB
288c29e8801246fafb2ce34430bac1f42e9018 412B
295a636079530b5858c376c697ed78fe006c0f 476B
2ab489f61605b806fca4f73e0f88a5da6c4918 1KB
2db3688e75a46f11de8db3ae3d2dcc43e28c9e 136B
311fa95bd164d67c346bf46cf12c57ecbed575 4KB
315fcfd3a24894b4a416771e9ebd14de432e29 457B
3383f3a0cd7ee8ff900fba6dc08af3b772d494 2KB
35530f0a4535a349b851587e2a6578c84d7814 3KB
35af0699ccec004cbe685ef938cd2d63ea7037 43B
3632a11751f51e1b32da05b9f7173b92e5790c 134B
38955397385e5b95ecf85fc1431ce152dc76f3 4KB
3d02eae123eb8d4c38b0c01e7756b772b2c8c9 61B
418cbebda925df91a3ab4f636160c11066e909 3KB
4470e4c10d17482fdf1db10b93dbeb14695699 936B
44baf89f50a9d17711f2e9635309a8a54c2c2a 415KB
46a4c61118fb5047614c5bc8818c41b1705c68 620B
47743afae3e6d48ab2b66998b49dd81f5f90d7 793B
497fa819953e9e7b401d3d46e49defc8857a7a 457B
49966254b609402b95419dc260fee0116852c9 627B
4a6c098538e65c56b3e6ec70833e2b3746a65c 85B
4df92006b706595ee009753d58327e3a3b3fe9 82B
4ef5469fe283971f87c9a158d934add748515b 864B
4ff982d9e090ec20bafbe288e9043ffea6a3bb 8KB
51b9963762cbb0cf9dcd79cd4316f1cf12b7d8 133B
51d45b5484b4271f4a07681560d6f5d6913108 6KB
53b68e542df0579630bb9f5cbc76e55acff729 30KB
565b70434038f7e4600dd116bb1f48e73f2ab2 111KB
5b588692869d0d2d5b6230583af207a65f3eca 5KB
5ea3ca0a9d97169cf8f573414e4bfe10ed20c4 3KB
5f37f545c56679c694216e1d7a3e1500f268f7 113B
620ba523c6d4f0e4993600cb3b59e67f872640 2KB
646a4ea083a7bd4283013aca01e7aac5b96094 3KB
651b4f1621203cda101f07972dcf72b63715d1 151B
68ec00e8c603a8f43d27edb76807acfb55a9ca 5KB
6af945d143782c2fabdf555a9cd84c0d30e113 932B
6b17176953731bf6152da4862fd8dddf2e43fb 3KB
6f054991379482c4cc08e07fffa4f182c531b2 230KB
70da1fa7f81756500f8393f6c5f96bcb511f6b 136B
730307c884aebeb443b4135d382a0a7e6b16bf 6KB
77ed7382b59b3717ee070837bde28f7eaa997f 153B
792e825e38db09bcd0c7b6e00d7ec3544135bb 345B
7937af1042acd797f5d50396a5e2805f4433c3 277B
7e63f34c4bc131433c7ce604e2917040eab692 224B
8090fb631d1f413008cfda62b36a357839ec3a 133B
813244d2237e81a20f3714ae075009da857de0 2KB
83dad28fd62c167b7846585343be3f23b37019 111B
8445a1f6f8e059b26f902c4a45115810e53e3f 303B
8541a50bf4e0d44b8ed08a7c024e9a2956d089 2KB
88837b729dd07b021bd8bb4310897baf02353f 1KB
891bee3d09043607ff9adfecb7503184b6da6f 135B
89fe18577a107358db45342b6799877460c89d 4KB
8ab13821cec37959f6891e9da602636a12aecc 2KB
8b5922be5a667f855c214ebb2e0bed34f3e901 168B
8c70e75ca135d092eb750ee6db1b4083dc12ea 128B
8ce0adf5021487d61cf4af5f1a618578a83e5d 2KB
8dc6495a31c1ed3d24cc3d6dfac5ff3e0d8caf 3KB
8df5a803cb28100cba63e69066b905e41ecbe4 1KB
92002ae4893ea77189f1a20d64712010cff94a 534B
94a99f8e2cc1877d7af50b2ceda8cfc5be32ba 309B
9a8b6c66b118bc3c19969429b4ace854064109 134B
9b21cfb64aa5a8713d7ccd5d02c67b47e06f20 383B
9e382a322b85fbc5160d74364f87729f09db0c 1KB
9ec2e22c6b3cfd825cd3154842b4483b7fab14 257KB
a42d482fb5239ef04382ab6223ea8784afd844 2KB
a53021202f6bd804d66e8c96e67748fa60d60f 571B
a5d35ed8f67fb8683dbb1833a6395b2f6fed65 1KB
a85ac67e4158607bed3093dbf541ce76ab4a2a 140B
ad77ab3e085088dc80c306925afdec2a555db9 378B
adbb810fdcf53e3c4d79a476fef9d8067d2167 261B
b15ede9b04d048b03e9e5977cb774f443b4b7f 3KB
b425c52936231923e8c43f6c5890ecd984bb5f 431B
b46b15619558cff34ce3902b807674a7364541 134B
b61dd1e4dbea270055aa14a095d7c4ef0fe20d 135B
b915f869b58ae84a2a57cbb573ad4064bd04f3 362B
b967d8ed9d14fb7decf903c9aad84eda43333e 197B
b9f95bedb8c91e4719e002baa5ef1f852e9426 134B
ba24e42843670d5dc9147330a86f4f044ac9ae 282B
ba29e98c36808bcc2e6f291cf59a0ddcb3ff3e 7KB
ba3470e2bb9d00a7cf28d255fe44be45a2ceec 545B
bac1d7d6ae6f40dc50db7441509e524b3993ee 38B
bbd247607bd3fafacb18e1ba6b6a4dec6953ab 4KB
共 1739 条
- 1
- 2
- 3
- 4
- 5
- 6
- 18
资源评论
- 小黑先生2020-05-12请问有些带数据的数据表吗?后台管理不行啊
水小白
- 粉丝: 8
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功