master
parent
88f7fd1ea5
commit
d7138cd806
|
@ -0,0 +1,30 @@
|
|||
package com.cy.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class WebAppConfig implements WebMvcConfigurer {
|
||||
|
||||
@Value("${imagesPath}")
|
||||
private String mImagesPath;
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
if(mImagesPath.equals("") || mImagesPath.equals("${imagesPath}")){
|
||||
String imagesPath = WebAppConfig.class.getClassLoader().getResource("").getPath();
|
||||
if(imagesPath.indexOf(".jar")>0){
|
||||
imagesPath = imagesPath.substring(0, imagesPath.indexOf(".jar"));
|
||||
}else if(imagesPath.indexOf("classes")>0){
|
||||
imagesPath = "file:"+imagesPath.substring(0, imagesPath.indexOf("classes"));
|
||||
}
|
||||
imagesPath = imagesPath.substring(0, imagesPath.lastIndexOf("/"))+"/images/";
|
||||
mImagesPath = imagesPath;
|
||||
}
|
||||
//LoggerFactory.getLogger(WebAppConfig.class).info("imagesPath="+mImagesPath);
|
||||
registry.addResourceHandler("/homeworkrs/**").addResourceLocations(mImagesPath);
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,8 @@ import com.cy.utils.KeyUtils;
|
|||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||
import org.apache.commons.fileupload.servlet.ServletFileUpload;
|
||||
import org.apache.tomcat.util.http.fileupload.IOUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -16,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.*;
|
||||
import java.sql.Array;
|
||||
|
@ -34,6 +37,9 @@ public class HomeworkController {
|
|||
@Resource
|
||||
DTODao dd;
|
||||
|
||||
@Value("${fileUpLoadPath}")
|
||||
String filePath;
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
@RequestMapping("showByType/{type}")
|
||||
|
@ -66,8 +72,8 @@ public class HomeworkController {
|
|||
}
|
||||
|
||||
@RequestMapping("showByTypeAndFinishTime/{page}")
|
||||
public Iterable<Homework> showByTypeAndFinishTime(@PathVariable("page") String page,HttpServletRequest request) {
|
||||
Pageable pageable = new PageRequest(Integer.parseInt(page),10);
|
||||
public Iterable<Homework> showByTypeAndFinishTime(@PathVariable("page") String page, HttpServletRequest request) {
|
||||
Pageable pageable = new PageRequest(Integer.parseInt(page), 10);
|
||||
String type = request.getParameter("type");
|
||||
java.util.Date d1 = null;
|
||||
try {
|
||||
|
@ -77,7 +83,7 @@ public class HomeworkController {
|
|||
e.printStackTrace();
|
||||
}
|
||||
Date d2 = new Date(d1.getTime());
|
||||
return hs.findByTypeAndFinishTime(type, d2,pageable);
|
||||
return hs.findByTypeAndFinishTime(type, d2, pageable);
|
||||
}
|
||||
|
||||
@RequestMapping("save")
|
||||
|
@ -122,10 +128,10 @@ public class HomeworkController {
|
|||
String originalFilename = myFile.getOriginalFilename();
|
||||
int pos = originalFilename.lastIndexOf(".");
|
||||
String suffix = originalFilename.substring(pos);
|
||||
String realPath = "D:/tmp";
|
||||
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
String fullPath = realPath + File.separator + uuid + suffix;
|
||||
String homeworkid=File.separator + uuid + suffix;
|
||||
String fullPath = filePath + File.separator + uuid + suffix;
|
||||
String homeworkid = File.separator + uuid + suffix;
|
||||
InputStream in = null;
|
||||
try {
|
||||
in = myFile.getInputStream();
|
||||
|
@ -140,16 +146,38 @@ public class HomeworkController {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Map map= new HashMap();
|
||||
map.put("result",homeworkid);
|
||||
Map map = new HashMap();
|
||||
map.put("result", homeworkid);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/download/{homeworkid}", method = RequestMethod.GET)
|
||||
public void downLoad(@PathVariable("homeworkid") String homeworkid, HttpServletResponse response) {
|
||||
List<Map<String, Object>> list = dd.queryfindhomework(homeworkid);
|
||||
for (int i=0;i<list.size();i++){
|
||||
String fileName = (String)list.get(i).get("homeworkid");
|
||||
String fullPath = filePath + File.separator + fileName;
|
||||
response.setContentType("application/force-download");
|
||||
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName);// 设置文件名;
|
||||
//response.setHeader("Content-Disposition", "attachment;filename="+new String(fileName.getBytes("GBK"),"ISO-8859-1"));
|
||||
try {
|
||||
File downloadFile = new File(fullPath);
|
||||
FileInputStream inputStream = new FileInputStream(downloadFile);
|
||||
IOUtils.copy(inputStream, response.getOutputStream());
|
||||
response.flushBuffer();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("saveDetails/{uid}/{hid}/{result}")
|
||||
public Map saveDetails(@PathVariable("uid") String uid, @PathVariable("hid") String hid,@PathVariable("result") String homeworkid) {
|
||||
public Map saveDetails(@PathVariable("uid") String uid, @PathVariable("hid") String hid, @PathVariable("result") String homeworkid) {
|
||||
Map map = new HashMap();
|
||||
int rs = hs.savedetails(uid, hid,homeworkid);
|
||||
int rs = hs.savedetails(uid, hid, homeworkid);
|
||||
if (rs > 0) {
|
||||
map.put("rs", "success");
|
||||
} else if (rs == -1) {
|
||||
|
|
|
@ -52,8 +52,7 @@ public class UserController {
|
|||
public User login(@RequestBody User user) {
|
||||
String loginName = user.getUsername();
|
||||
String password = user.getPassword();
|
||||
String type = user.getType();
|
||||
User user1 = us.findByNameAndPassword(loginName, password,type);
|
||||
User user1 = us.findByNameAndPassword(loginName, password);
|
||||
if (user1 != null) {
|
||||
return user1;
|
||||
} else {
|
||||
|
|
|
@ -6,9 +6,9 @@ public class HomeworkUserDTO {
|
|||
private String id;
|
||||
private String username;
|
||||
private String hid;
|
||||
|
||||
private Date completeTime;
|
||||
private String completeTime;
|
||||
private String status;
|
||||
private String homeworkid;
|
||||
|
||||
|
||||
public String getId() {
|
||||
|
@ -37,11 +37,11 @@ public class HomeworkUserDTO {
|
|||
|
||||
|
||||
|
||||
public Date getCompleteTime() {
|
||||
public String getCompleteTime() {
|
||||
return completeTime;
|
||||
}
|
||||
|
||||
public void setCompleteTime(Date completeTime) {
|
||||
public void setCompleteTime(String completeTime) {
|
||||
this.completeTime = completeTime;
|
||||
}
|
||||
|
||||
|
@ -52,4 +52,12 @@ public class HomeworkUserDTO {
|
|||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getHomeworkid() {
|
||||
return homeworkid;
|
||||
}
|
||||
|
||||
public void setHomeworkid(String homeworkid) {
|
||||
this.homeworkid = homeworkid;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ public class DTODao {
|
|||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
public List<Map<String, Object>> queryHomeworkUserDTOListMap(Homework homework) {
|
||||
String sql = "SELECT u.id,u.username,uh.h_id,uh.complete_time from `user` u LEFT JOIN user_homework uh on (u.id=uh.u_id and uh.h_id= ? )where u.type='student'";
|
||||
String sql = "SELECT u.id,u.username,uh.h_id,uh.complete_time,uh.homeworkid from `user` u LEFT JOIN user_homework uh on (u.id=uh.u_id and uh.h_id= ? )where u.type='student'";
|
||||
Object[] args = {homework.getId()};
|
||||
int[] argTypes = {Types.VARCHAR};
|
||||
|
||||
|
@ -52,10 +52,19 @@ public class DTODao {
|
|||
}
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> queryfindexist(String uid, String hid) {
|
||||
String sql = ("select * from user_homework where h_id=? AND u_id=?");
|
||||
Object[] args = {hid, uid};
|
||||
int[] argTypes = {Types.VARCHAR, Types.VARCHAR};
|
||||
public List<Map<String, Object>> queryfindhomework(String homeworkid) {
|
||||
String sql = ("select * from user_homework where homeworkid=? ");
|
||||
Object[] args = {homeworkid};
|
||||
int[] argTypes = {Types.VARCHAR};
|
||||
return this.jdbcTemplate.queryForList(sql, args,argTypes);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> queryfindexit(String uid,String hid) {
|
||||
String sql = ("select * from user_homework where u_id=? AND h_id=? ");
|
||||
Object[] args = {uid,hid};
|
||||
int[] argTypes = {Types.VARCHAR,Types.VARCHAR};
|
||||
return this.jdbcTemplate.queryForList(sql, args,argTypes);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,5 +9,5 @@ import java.util.List;
|
|||
public interface UserRepository extends JpaRepository<User,String> {
|
||||
List<User> findByUsername(String username);
|
||||
|
||||
User findByUsernameAndPasswordAndType(String username, String password,String type);
|
||||
User findByUsernameAndPassword(String username, String password);
|
||||
}
|
||||
|
|
|
@ -60,13 +60,14 @@ public class HomeworkService {
|
|||
String id = (String) listmap.get(i).get("id");
|
||||
String username = (String) listmap.get(i).get("username");
|
||||
String hid = (String) listmap.get(i).get("hid");
|
||||
String homeworkid = (String) listmap.get(i).get("homeworkid");
|
||||
try {
|
||||
if (listmap.get(i).get("complete_time") != null) {
|
||||
Date completeTime = new Date(sdf.parse(listmap.get(i).get("complete_time").toString()).getTime());
|
||||
hud.setCompleteTime(completeTime);
|
||||
hud.setCompleteTime(sdf.format(completeTime));
|
||||
} else {
|
||||
Date completeTime = null;
|
||||
hud.setCompleteTime(completeTime);
|
||||
|
||||
hud.setCompleteTime("");
|
||||
}
|
||||
|
||||
} catch (ParseException e) {
|
||||
|
@ -75,13 +76,13 @@ public class HomeworkService {
|
|||
hud.setId(id);
|
||||
hud.setUsername(username);
|
||||
hud.setHid(hid);
|
||||
if (hud.getCompleteTime() == null) {
|
||||
hud.setHomeworkid(homeworkid);
|
||||
if (hud.getCompleteTime() == "") {
|
||||
hud.setStatus("未完成");
|
||||
} else {
|
||||
hud.setStatus("完成");
|
||||
}
|
||||
ah.add(hud);
|
||||
|
||||
}
|
||||
return ah;
|
||||
}
|
||||
|
@ -109,7 +110,9 @@ public class HomeworkService {
|
|||
if (new Date(System.currentTimeMillis()).getTime() > list.get(0).getFinishTime().getTime()) {
|
||||
rs = -1;
|
||||
} else {
|
||||
if (dd.queryfindexist(uid, hid).size() > 0) {
|
||||
// dd.queryuploadDTOListMap(uid, hid, homeworkid,new Timestamp(new java.util.Date().getTime()));
|
||||
// rs = 1;
|
||||
if (dd.queryfindexit(uid,hid).size() > 0) {
|
||||
dd.queryuploadDTOListMap2(uid, hid, homeworkid,new Timestamp(new java.util.Date().getTime()));
|
||||
rs = 1;
|
||||
} else {
|
||||
|
@ -119,4 +122,6 @@ public class HomeworkService {
|
|||
}
|
||||
return rs;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ public class UserService {
|
|||
return ur.findByUsername(name);
|
||||
}
|
||||
|
||||
public User findByNameAndPassword(String name,String password,String type){
|
||||
return ur.findByUsernameAndPasswordAndType(name,password,type);
|
||||
public User findByNameAndPassword(String name,String password){
|
||||
return ur.findByUsernameAndPassword(name,password);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
fileUpLoadPath=C://tmp//
|
||||
imagesPath=file:/C:/tmp/
|
|
@ -0,0 +1,2 @@
|
|||
fileUpLoadPath=/usr/lib
|
||||
imagesPath=file://usr/lib/
|
|
@ -1,8 +1,10 @@
|
|||
server.port=9084
|
||||
server.servlet.context-path=/SpringBootHomework
|
||||
server.servlet.context-path=/hw
|
||||
spring.datasource.url=jdbc:mysql://118.24.99.140:3306/zzty?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=Aa_114514
|
||||
spring.jpa.database=MYSQL
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.profiles.active=dev
|
||||
#spring.profiles.active=prod
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Insert title here</title>
|
||||
</head>
|
||||
<body>
|
||||
<img src="images/15642347670392018.jpg">
|
||||
<a href="images/1564233497341jquery-ui-1.11.1.zip">下载</a>
|
||||
</body>
|
||||
</html>
|
|
@ -319,6 +319,34 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="modal fade" id="detailmodal">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
|
||||
<!-- 模态框头部 -->
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">内容</h4>
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
|
||||
<!-- 模态框主体 -->
|
||||
<div class="modal-body ">
|
||||
<a id ="downloadbody" style="height:300px;overflow:auto; "></a>
|
||||
</div>
|
||||
|
||||
<!-- 模态框底部 -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ============================================================== -->
|
||||
|
|
|
@ -194,30 +194,46 @@ $(document).ready(function () {
|
|||
})
|
||||
|
||||
$("button[name='checkbtn']").click(function () {
|
||||
var fmt = SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
$.getJSON("homework/showdetails/" + this.id, {"id": this.id}, function (json) {
|
||||
$("#dtbodybtn").empty();
|
||||
for (var i = 0; i < json.length; i++) {
|
||||
$("#dtbodybtn").append(
|
||||
"<tr id='tridval" + i + "'>"
|
||||
+ "<td>" + json[i].id
|
||||
+ "</td>"
|
||||
+ "<td>" + json[i].username
|
||||
+ "</td>"
|
||||
+ "<td>" + fmt.format(json[i].completeTime)
|
||||
+ "</td>"
|
||||
+ "<td>" + json[i].status
|
||||
+ "</td>"
|
||||
+ "</tr>"
|
||||
)
|
||||
$("#dtbodybtn").append(
|
||||
"<tr id='tridval" + i + "'>"
|
||||
+ "<td>" + json[i].id
|
||||
+ "</td>"
|
||||
+ "<td>" + json[i].username
|
||||
+ "</td>"
|
||||
+ "<td>" + json[i].completeTime
|
||||
+ "</td>"
|
||||
+ "<td>" + json[i].status
|
||||
+ "</td>"
|
||||
+ "<td><button type='button' class='btn btn-primary' name='detailmodalbtn' id='" + json[i].homeworkid + "'>查看</button></td>"
|
||||
+ "<td><a href='"+"http://localhost:9084/hw/homeworkrs/"+json[i].homeworkid+"'>下载</a></td>"
|
||||
+ "</tr>"
|
||||
)
|
||||
if (logintype == "student") {
|
||||
$("button[name='detailmodalbtn']").attr("style", "display:none;");
|
||||
}
|
||||
$("button[name='detailmodalbtn']").click(function () {
|
||||
$("#downloadbody").empty();
|
||||
$('#modalhwdetail2').modal("hide");
|
||||
$('#detailmodal').modal("show");
|
||||
console.log(this.id);
|
||||
$.get("homework/download/"+this.id,function (json) {
|
||||
$("#downloadbody").append(json);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
$('#modalhwdetail2').modal("show");
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
$("button[name='uploadbtn']").click(function () {
|
||||
var hid = this.id;
|
||||
var uid = loginid;
|
||||
|
@ -234,15 +250,12 @@ $(document).ready(function () {
|
|||
if (resp.result != null) {
|
||||
$.getJSON("homework/saveDetails/" + uid + "/" + hid + "/" + resp.result, function (json) {
|
||||
if ("outtime" == json.rs) {
|
||||
alert("已超时");
|
||||
} else if ("fail" == json.rs) {
|
||||
alert("失败");
|
||||
} else {
|
||||
alert(" 添加成功");
|
||||
$('#modalhwdetail2').modal('hide');
|
||||
alert("上传成功");
|
||||
window.location.href = "index4.html";
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
alert("上传失败");
|
||||
}
|
||||
|
@ -261,150 +274,10 @@ $(document).ready(function () {
|
|||
var type = $("#searchtype").val();
|
||||
var finishTime = $("#searchfinishTime").val();
|
||||
getdata(0,type,finishTime);
|
||||
// $.getJSON("homework/showByTypeAndFinishTime", {type: type, finishTime: finishTime}, function (json) {
|
||||
// $("#tbodymainbtn").empty();
|
||||
// for (var i = 0; i < json.length; i++) {
|
||||
// $("#tbodymainbtn").append(
|
||||
// "<tr id='tridval" + i + "'>"
|
||||
// + "<td>" + json[i].id
|
||||
// + "</td>"
|
||||
// + "<td>" + json[i].title
|
||||
// + "</td>"
|
||||
// + "<td>" + json[i].type
|
||||
// + "</td>"
|
||||
// + "<td>" + json[i].updateTime
|
||||
// + "</td>"
|
||||
// + "<td>" + json[i].finishTime
|
||||
// + "</td>"
|
||||
// + "<td><button type='button' class='btn btn-primary' name='changebtn' id='" + json[i].id + "'>编辑</button></td>"
|
||||
// + "<td><button type='button' class='btn btn-primary' name='checkbtn' id='" + json[i].id + "'>查看</button></td>"
|
||||
// + "<td><button type='button' class='btn btn-primary' name='deletebtn' id='" + json[i].id + "'>删除</button></td>"
|
||||
// + "<td><button type='button' class='btn btn-primary' name='uploadbtn' id='" + json[i].id + "'>上传</button></td>"
|
||||
// + "</tr>"
|
||||
// );
|
||||
// }
|
||||
// if (logintype == "student") {
|
||||
// $("button[name='changebtn']").attr("style", "display:none;");
|
||||
// $("button[name='deletebtn']").attr("style", "display:none;");
|
||||
// }
|
||||
// $("button[name='changebtn']").click(function () {
|
||||
// var id = this.id
|
||||
// var fmt = SimpleDateFormat("yyyy-MM-dd");
|
||||
// $.getJSON("homework/findAllById/" + id, {id: id}, function (js) {
|
||||
// $("#changebtn").empty();
|
||||
// $("#id").attr("value", js[0].id);
|
||||
// $("#hwtitle").attr("value", js[0].title);
|
||||
// $("#hwtype").attr("value", js[0].type);
|
||||
// $("#hwupdateTime").attr("value", fmt.format(js[0].updateTime));
|
||||
// $("#hwfinishTime").attr("value", fmt.format(js[0].finishTime));
|
||||
// document.getElementById("hwdetails").innerHTML = js[0].details;
|
||||
// $('#modalhwdetail').modal("show");
|
||||
// $("button[name='btnn']").click(function () {
|
||||
// var adata = {
|
||||
// "id": $("#id").val(),
|
||||
// "title": $("#hwtitle").val(),
|
||||
// "type": $("#hwtype").val(),
|
||||
// "updateTime": $("#hwupdateTime").val(),
|
||||
// "finishTime": $("#hwfinishTime").val(),
|
||||
// "details": $("#hwdetails").val()
|
||||
// }
|
||||
// var data = JSON.stringify(adata);
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// contentType: "application/json",
|
||||
// data: data,
|
||||
// url: "homework/update",
|
||||
// success: function (res) {
|
||||
// if (res != "") {
|
||||
// alert("修改成功");
|
||||
// window.location.href = "index4.html";
|
||||
// } else {
|
||||
// alert("修改失败");
|
||||
// window.location.href = "index4.html";
|
||||
// }
|
||||
// },
|
||||
// error: function () {
|
||||
// alert("失败");
|
||||
// window.location.href = "index4.html";
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
//
|
||||
// $("button[name='deletebtn']").click(function () {
|
||||
// var id = this.id;
|
||||
// console.log(id);
|
||||
// $.getJSON("homework/deleteById/" + id, {id: id}, function (rs) {
|
||||
// if (rs.rs == 'success') {
|
||||
// window.location.href = "index4.html";
|
||||
// } else {
|
||||
// alert("删除失败");
|
||||
// window.location.href = "index4.html";
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
//
|
||||
// $("button[name='checkbtn']").click(function () {
|
||||
// var fmt = SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// $.getJSON("homework/showdetails/" + this.id, {"id": this.id}, function (json) {
|
||||
// $("#dtbodybtn").empty();
|
||||
// for (var i = 0; i < json.length; i++) {
|
||||
// $("#dtbodybtn").append(
|
||||
// "<tr id='tridval" + i + "'>"
|
||||
// + "<td>" + json[i].id
|
||||
// + "</td>"
|
||||
// + "<td>" + json[i].username
|
||||
// + "</td>"
|
||||
// + "<td>" + fmt.format(json[i].completeTime)
|
||||
// + "</td>"
|
||||
// + "<td>" + json[i].status
|
||||
// + "</td>"
|
||||
// + "</tr>"
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// })
|
||||
// $('#modalhwdetail2').modal("show");
|
||||
//
|
||||
//
|
||||
// })
|
||||
//
|
||||
// $("button[name='uploadbtn']").click(function () {
|
||||
// var hid = this.id;
|
||||
// var uid = loginid;
|
||||
// $('#uploadmodal').modal("show");
|
||||
// $("button[name='uploadbtn2']").click(function () {
|
||||
// var formData = new FormData(document.getElementById("upload-form"));
|
||||
// $.ajax({
|
||||
// url: "homework/upload",
|
||||
// method: 'POST',
|
||||
// data: formData,
|
||||
// contentType: false,
|
||||
// processData: false,
|
||||
// success: function (resp) {
|
||||
// if (resp.result != null) {
|
||||
// $.getJSON("homework/saveDetails/" + uid + "/" + hid + "/" + resp.result, function (json) {
|
||||
// if ("outtime" == json.rs) {
|
||||
// alert("已超时");
|
||||
// } else if ("fail" == json.rs) {
|
||||
// alert("失败");
|
||||
// } else {
|
||||
// alert(" 添加成功");
|
||||
// $('#modalhwdetail2').modal('hide');
|
||||
// }
|
||||
// })
|
||||
//
|
||||
// } else {
|
||||
// alert("上传失败");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
|
|
@ -33,8 +33,7 @@ $(function () {
|
|||
|
||||
var adata = {
|
||||
"username": $("#name").val(),
|
||||
"password": $("#pwd").val(),
|
||||
"type": $("#type").val()
|
||||
"password": $("#pwd").val()
|
||||
}
|
||||
var data = JSON.stringify(adata);
|
||||
$.ajax({
|
||||
|
|
|
@ -32,13 +32,6 @@
|
|||
<input type="password" class="lowin-input" id="pwd" name="userpwd" >
|
||||
<p style="color:red;display: none" id="pwdp" >密码不为空</p>
|
||||
</div>
|
||||
<div class="lowin-group">
|
||||
<label>类型 </label>
|
||||
<select class="lowin-input" name="type" id="type">
|
||||
<option value='teacher'>教师</option>
|
||||
<option value='student'>学生</option>
|
||||
</select>
|
||||
</div>
|
||||
<br>
|
||||
<button type="button" class="lowin-btn login-btn" id="btn" name="btn">
|
||||
登陆
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.cy.repository;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class DTODaoTest {
|
||||
|
||||
@Test
|
||||
public void queryuploadDTOListMap() {
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven Integration for Eclipse
|
||||
#Sat Aug 17 21:27:10 CST 2019
|
||||
#Mon Aug 19 19:59:23 CST 2019
|
||||
version=0.0.1-SNAPSHOT
|
||||
groupId=zz
|
||||
m2e.projectName=SpringBootHomework
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
fileUpLoadPath=C://tmp//
|
||||
imagesPath=file:/C:/tmp/
|
|
@ -0,0 +1,2 @@
|
|||
fileUpLoadPath=/usr/lib
|
||||
imagesPath=file://usr/lib/
|
|
@ -1,8 +1,10 @@
|
|||
server.port=9084
|
||||
server.servlet.context-path=/SpringBootHomework
|
||||
server.servlet.context-path=/hw
|
||||
spring.datasource.url=jdbc:mysql://118.24.99.140:3306/zzty?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=Aa_114514
|
||||
spring.jpa.database=MYSQL
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.profiles.active=dev
|
||||
#spring.profiles.active=prod
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Insert title here</title>
|
||||
</head>
|
||||
<body>
|
||||
<img src="images/15642347670392018.jpg">
|
||||
<a href="images/1564233497341jquery-ui-1.11.1.zip">下载</a>
|
||||
</body>
|
||||
</html>
|
|
@ -319,6 +319,34 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="modal fade" id="detailmodal">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
|
||||
<!-- 模态框头部 -->
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">内容</h4>
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
|
||||
<!-- 模态框主体 -->
|
||||
<div class="modal-body ">
|
||||
<a id ="downloadbody" style="height:300px;overflow:auto; "></a>
|
||||
</div>
|
||||
|
||||
<!-- 模态框底部 -->
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ============================================================== -->
|
||||
|
|
|
@ -194,30 +194,46 @@ $(document).ready(function () {
|
|||
})
|
||||
|
||||
$("button[name='checkbtn']").click(function () {
|
||||
var fmt = SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
$.getJSON("homework/showdetails/" + this.id, {"id": this.id}, function (json) {
|
||||
$("#dtbodybtn").empty();
|
||||
for (var i = 0; i < json.length; i++) {
|
||||
$("#dtbodybtn").append(
|
||||
"<tr id='tridval" + i + "'>"
|
||||
+ "<td>" + json[i].id
|
||||
+ "</td>"
|
||||
+ "<td>" + json[i].username
|
||||
+ "</td>"
|
||||
+ "<td>" + fmt.format(json[i].completeTime)
|
||||
+ "</td>"
|
||||
+ "<td>" + json[i].status
|
||||
+ "</td>"
|
||||
+ "</tr>"
|
||||
)
|
||||
$("#dtbodybtn").append(
|
||||
"<tr id='tridval" + i + "'>"
|
||||
+ "<td>" + json[i].id
|
||||
+ "</td>"
|
||||
+ "<td>" + json[i].username
|
||||
+ "</td>"
|
||||
+ "<td>" + json[i].completeTime
|
||||
+ "</td>"
|
||||
+ "<td>" + json[i].status
|
||||
+ "</td>"
|
||||
+ "<td><button type='button' class='btn btn-primary' name='detailmodalbtn' id='" + json[i].homeworkid + "'>查看</button></td>"
|
||||
+ "<td><a href='"+"http://localhost:9084/hw/homeworkrs/"+json[i].homeworkid+"'>下载</a></td>"
|
||||
+ "</tr>"
|
||||
)
|
||||
if (logintype == "student") {
|
||||
$("button[name='detailmodalbtn']").attr("style", "display:none;");
|
||||
}
|
||||
$("button[name='detailmodalbtn']").click(function () {
|
||||
$("#downloadbody").empty();
|
||||
$('#modalhwdetail2').modal("hide");
|
||||
$('#detailmodal').modal("show");
|
||||
console.log(this.id);
|
||||
$.get("homework/download/"+this.id,function (json) {
|
||||
$("#downloadbody").append(json);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
$('#modalhwdetail2').modal("show");
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
$("button[name='uploadbtn']").click(function () {
|
||||
var hid = this.id;
|
||||
var uid = loginid;
|
||||
|
@ -234,15 +250,12 @@ $(document).ready(function () {
|
|||
if (resp.result != null) {
|
||||
$.getJSON("homework/saveDetails/" + uid + "/" + hid + "/" + resp.result, function (json) {
|
||||
if ("outtime" == json.rs) {
|
||||
alert("已超时");
|
||||
} else if ("fail" == json.rs) {
|
||||
alert("失败");
|
||||
} else {
|
||||
alert(" 添加成功");
|
||||
$('#modalhwdetail2').modal('hide');
|
||||
alert("上传成功");
|
||||
window.location.href = "index4.html";
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
alert("上传失败");
|
||||
}
|
||||
|
@ -261,150 +274,10 @@ $(document).ready(function () {
|
|||
var type = $("#searchtype").val();
|
||||
var finishTime = $("#searchfinishTime").val();
|
||||
getdata(0,type,finishTime);
|
||||
// $.getJSON("homework/showByTypeAndFinishTime", {type: type, finishTime: finishTime}, function (json) {
|
||||
// $("#tbodymainbtn").empty();
|
||||
// for (var i = 0; i < json.length; i++) {
|
||||
// $("#tbodymainbtn").append(
|
||||
// "<tr id='tridval" + i + "'>"
|
||||
// + "<td>" + json[i].id
|
||||
// + "</td>"
|
||||
// + "<td>" + json[i].title
|
||||
// + "</td>"
|
||||
// + "<td>" + json[i].type
|
||||
// + "</td>"
|
||||
// + "<td>" + json[i].updateTime
|
||||
// + "</td>"
|
||||
// + "<td>" + json[i].finishTime
|
||||
// + "</td>"
|
||||
// + "<td><button type='button' class='btn btn-primary' name='changebtn' id='" + json[i].id + "'>编辑</button></td>"
|
||||
// + "<td><button type='button' class='btn btn-primary' name='checkbtn' id='" + json[i].id + "'>查看</button></td>"
|
||||
// + "<td><button type='button' class='btn btn-primary' name='deletebtn' id='" + json[i].id + "'>删除</button></td>"
|
||||
// + "<td><button type='button' class='btn btn-primary' name='uploadbtn' id='" + json[i].id + "'>上传</button></td>"
|
||||
// + "</tr>"
|
||||
// );
|
||||
// }
|
||||
// if (logintype == "student") {
|
||||
// $("button[name='changebtn']").attr("style", "display:none;");
|
||||
// $("button[name='deletebtn']").attr("style", "display:none;");
|
||||
// }
|
||||
// $("button[name='changebtn']").click(function () {
|
||||
// var id = this.id
|
||||
// var fmt = SimpleDateFormat("yyyy-MM-dd");
|
||||
// $.getJSON("homework/findAllById/" + id, {id: id}, function (js) {
|
||||
// $("#changebtn").empty();
|
||||
// $("#id").attr("value", js[0].id);
|
||||
// $("#hwtitle").attr("value", js[0].title);
|
||||
// $("#hwtype").attr("value", js[0].type);
|
||||
// $("#hwupdateTime").attr("value", fmt.format(js[0].updateTime));
|
||||
// $("#hwfinishTime").attr("value", fmt.format(js[0].finishTime));
|
||||
// document.getElementById("hwdetails").innerHTML = js[0].details;
|
||||
// $('#modalhwdetail').modal("show");
|
||||
// $("button[name='btnn']").click(function () {
|
||||
// var adata = {
|
||||
// "id": $("#id").val(),
|
||||
// "title": $("#hwtitle").val(),
|
||||
// "type": $("#hwtype").val(),
|
||||
// "updateTime": $("#hwupdateTime").val(),
|
||||
// "finishTime": $("#hwfinishTime").val(),
|
||||
// "details": $("#hwdetails").val()
|
||||
// }
|
||||
// var data = JSON.stringify(adata);
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// contentType: "application/json",
|
||||
// data: data,
|
||||
// url: "homework/update",
|
||||
// success: function (res) {
|
||||
// if (res != "") {
|
||||
// alert("修改成功");
|
||||
// window.location.href = "index4.html";
|
||||
// } else {
|
||||
// alert("修改失败");
|
||||
// window.location.href = "index4.html";
|
||||
// }
|
||||
// },
|
||||
// error: function () {
|
||||
// alert("失败");
|
||||
// window.location.href = "index4.html";
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
//
|
||||
// $("button[name='deletebtn']").click(function () {
|
||||
// var id = this.id;
|
||||
// console.log(id);
|
||||
// $.getJSON("homework/deleteById/" + id, {id: id}, function (rs) {
|
||||
// if (rs.rs == 'success') {
|
||||
// window.location.href = "index4.html";
|
||||
// } else {
|
||||
// alert("删除失败");
|
||||
// window.location.href = "index4.html";
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
//
|
||||
// $("button[name='checkbtn']").click(function () {
|
||||
// var fmt = SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// $.getJSON("homework/showdetails/" + this.id, {"id": this.id}, function (json) {
|
||||
// $("#dtbodybtn").empty();
|
||||
// for (var i = 0; i < json.length; i++) {
|
||||
// $("#dtbodybtn").append(
|
||||
// "<tr id='tridval" + i + "'>"
|
||||
// + "<td>" + json[i].id
|
||||
// + "</td>"
|
||||
// + "<td>" + json[i].username
|
||||
// + "</td>"
|
||||
// + "<td>" + fmt.format(json[i].completeTime)
|
||||
// + "</td>"
|
||||
// + "<td>" + json[i].status
|
||||
// + "</td>"
|
||||
// + "</tr>"
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// })
|
||||
// $('#modalhwdetail2').modal("show");
|
||||
//
|
||||
//
|
||||
// })
|
||||
//
|
||||
// $("button[name='uploadbtn']").click(function () {
|
||||
// var hid = this.id;
|
||||
// var uid = loginid;
|
||||
// $('#uploadmodal').modal("show");
|
||||
// $("button[name='uploadbtn2']").click(function () {
|
||||
// var formData = new FormData(document.getElementById("upload-form"));
|
||||
// $.ajax({
|
||||
// url: "homework/upload",
|
||||
// method: 'POST',
|
||||
// data: formData,
|
||||
// contentType: false,
|
||||
// processData: false,
|
||||
// success: function (resp) {
|
||||
// if (resp.result != null) {
|
||||
// $.getJSON("homework/saveDetails/" + uid + "/" + hid + "/" + resp.result, function (json) {
|
||||
// if ("outtime" == json.rs) {
|
||||
// alert("已超时");
|
||||
// } else if ("fail" == json.rs) {
|
||||
// alert("失败");
|
||||
// } else {
|
||||
// alert(" 添加成功");
|
||||
// $('#modalhwdetail2').modal('hide');
|
||||
// }
|
||||
// })
|
||||
//
|
||||
// } else {
|
||||
// alert("上传失败");
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// })
|
||||
// })
|
||||
// })
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
|
|
@ -33,8 +33,7 @@ $(function () {
|
|||
|
||||
var adata = {
|
||||
"username": $("#name").val(),
|
||||
"password": $("#pwd").val(),
|
||||
"type": $("#type").val()
|
||||
"password": $("#pwd").val()
|
||||
}
|
||||
var data = JSON.stringify(adata);
|
||||
$.ajax({
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<div class="lowin-box lowin-login">
|
||||
<div class="lowin-box-inner">
|
||||
<form>
|
||||
<p>Sign in to continue</p>
|
||||
<p>登录</p>
|
||||
<div class="lowin-group">
|
||||
<label>用户名 <a href="#" class="login-back-link">Sign in?</a></label>
|
||||
<input type="text" class="lowin-input" id="name" name="username" >
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue