├── WebRoot
├── static
│ ├── js
│ │ ├── lab
│ │ │ ├── content.js
│ │ │ └── lab_info.js
│ │ ├── approvement
│ │ │ ├── approve_buy_record.js
│ │ │ └── approve_buy_record_detail.js
│ │ ├── login
│ │ │ └── login.js
│ │ ├── record
│ │ │ └── buy-record.js
│ │ └── equipment
│ │ │ ├── equipment.js
│ │ │ └── request_buy_equipment.js
│ └── css
│ │ ├── lab
│ │ ├── header.css
│ │ ├── user_message.css
│ │ ├── lab_info.css
│ │ ├── content.css
│ │ └── main.css
│ │ ├── images
│ │ ├── h1.jpg
│ │ ├── h2.jpg
│ │ ├── h3.png
│ │ ├── h4.png
│ │ ├── h5.png
│ │ ├── h6.png
│ │ ├── tyut.png
│ │ ├── error.png
│ │ ├── error-c.png
│ │ ├── lab_icon.png
│ │ ├── check-box-outline-blank.svg
│ │ ├── check-box.svg
│ │ ├── add.svg
│ │ ├── details.svg
│ │ ├── operation.svg
│ │ └── delete.svg
│ │ ├── equipment
│ │ ├── equipment.css
│ │ ├── request_buy_equipment.css
│ │ └── table.css
│ │ ├── approvement
│ │ └── request_buy_record_detail.css
│ │ ├── login
│ │ └── login.css
│ │ └── record
│ │ └── request_buy_record.css
├── META-INF
│ └── MANIFEST.MF
├── index.jsp
└── WEB-INF
│ ├── web.xml
│ └── jsp
│ ├── lab
│ ├── header.jsp
│ ├── content-bak.jsp
│ └── content.jsp
│ ├── equipment
│ └── request_buy_equipment.jsp
│ ├── approvement
│ ├── approve_buy_record_detail.jsp
│ └── applied_buy_record_detail.jsp
│ ├── record
│ ├── deleted_record.jsp
│ └── request_buy_record.jsp
│ └── login
│ └── login.jsp
├── src
├── app.properties
├── top
│ └── yjzloveyzh
│ │ ├── common
│ │ ├── utils
│ │ │ ├── PathUtil.java
│ │ │ ├── PermissionUtil.java
│ │ │ ├── StringUtil.java
│ │ │ ├── MD5Util.java
│ │ │ ├── PropertyUtil.java
│ │ │ ├── CookieUtil.java
│ │ │ └── PaginationUtil.java
│ │ ├── exception
│ │ │ ├── UserException.java
│ │ │ ├── EquipmentException.java
│ │ │ └── RecordException.java
│ │ ├── pojo
│ │ │ ├── LabPermission.java
│ │ │ ├── Permission.java
│ │ │ ├── LabEquipmentCount.java
│ │ │ ├── Role.java
│ │ │ ├── DeletedRecord.java
│ │ │ ├── Lab.java
│ │ │ ├── RequestEquipment.java
│ │ │ ├── Pagination.java
│ │ │ ├── Equipment.java
│ │ │ ├── RequestBuyRecord.java
│ │ │ └── User.java
│ │ └── Constants.java
│ │ ├── services
│ │ ├── LabService.java
│ │ ├── DeletedRecordService.java
│ │ ├── UserService.java
│ │ ├── EquipmentService.java
│ │ ├── RecordService.java
│ │ └── impl
│ │ │ ├── LabServiceImpl.java
│ │ │ ├── DeletedRecordServiceImpl.java
│ │ │ └── UserServiceImpl.java
│ │ ├── dao
│ │ ├── LabDao.java
│ │ ├── LabUserDao.java
│ │ ├── MySqlSessionDaoSupport.java
│ │ ├── DeletedRecordDao.java
│ │ ├── EquipmentDao.java
│ │ ├── impl
│ │ │ ├── LabDaoImpl.java
│ │ │ ├── DeletedRecordDaoImpl.java
│ │ │ ├── LabUserDaoImpl.java
│ │ │ ├── EquipmentDaoImpl.java
│ │ │ └── RecordDaoImpl.java
│ │ └── RecordDao.java
│ │ ├── web
│ │ └── filter
│ │ │ ├── CharacterEncodingFilter.java
│ │ │ └── SessionFilter.java
│ │ ├── controller
│ │ ├── DeletedRecordController.java
│ │ ├── LabController.java
│ │ ├── RecordController.java
│ │ ├── EquipmentController.java
│ │ ├── ApprovementController.java
│ │ └── UserController.java
│ │ └── mapper
│ │ ├── DeleteRecordMappper.xml
│ │ ├── LabMapper.xml
│ │ ├── UserMapper.xml
│ │ └── EquipmentMapper.xml
├── mysql.properties
├── mybatis-config.xml
├── log4j.properties
├── springMVC-servlet.xml
└── applicationContext.xml
├── screenshot
├── 1.png
├── 2.png
├── 3.png
├── 4.png
├── 5.png
├── 6.png
├── 7.png
├── 8.png
└── 9.png
├── SSM框架下的实验室管理系统.docx
├── .gitignore
└── README.md
/WebRoot/static/js/lab/content.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/WebRoot/static/css/lab/header.css:
--------------------------------------------------------------------------------
1 | @CHARSET "UTF-8";
2 |
3 |
--------------------------------------------------------------------------------
/WebRoot/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Class-Path:
3 |
4 |
--------------------------------------------------------------------------------
/src/app.properties:
--------------------------------------------------------------------------------
1 | request_buy_record_per_page_count=15
2 | pagination_choose_list=7
--------------------------------------------------------------------------------
/screenshot/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/screenshot/1.png
--------------------------------------------------------------------------------
/screenshot/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/screenshot/2.png
--------------------------------------------------------------------------------
/screenshot/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/screenshot/3.png
--------------------------------------------------------------------------------
/screenshot/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/screenshot/4.png
--------------------------------------------------------------------------------
/screenshot/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/screenshot/5.png
--------------------------------------------------------------------------------
/screenshot/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/screenshot/6.png
--------------------------------------------------------------------------------
/screenshot/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/screenshot/7.png
--------------------------------------------------------------------------------
/screenshot/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/screenshot/8.png
--------------------------------------------------------------------------------
/screenshot/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/screenshot/9.png
--------------------------------------------------------------------------------
/SSM框架下的实验室管理系统.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/SSM框架下的实验室管理系统.docx
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/utils/PathUtil.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.utils;
2 |
3 | public class PathUtil {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/WebRoot/static/css/images/h1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/WebRoot/static/css/images/h1.jpg
--------------------------------------------------------------------------------
/WebRoot/static/css/images/h2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/WebRoot/static/css/images/h2.jpg
--------------------------------------------------------------------------------
/WebRoot/static/css/images/h3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/WebRoot/static/css/images/h3.png
--------------------------------------------------------------------------------
/WebRoot/static/css/images/h4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/WebRoot/static/css/images/h4.png
--------------------------------------------------------------------------------
/WebRoot/static/css/images/h5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/WebRoot/static/css/images/h5.png
--------------------------------------------------------------------------------
/WebRoot/static/css/images/h6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/WebRoot/static/css/images/h6.png
--------------------------------------------------------------------------------
/WebRoot/static/css/images/tyut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/WebRoot/static/css/images/tyut.png
--------------------------------------------------------------------------------
/WebRoot/static/css/images/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/WebRoot/static/css/images/error.png
--------------------------------------------------------------------------------
/WebRoot/static/css/images/error-c.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/WebRoot/static/css/images/error-c.png
--------------------------------------------------------------------------------
/WebRoot/static/css/images/lab_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YuLin-Coder/No183LaboratoryIntelligentManagementSystem/HEAD/WebRoot/static/css/images/lab_icon.png
--------------------------------------------------------------------------------
/src/mysql.properties:
--------------------------------------------------------------------------------
1 | driver = com.mysql.jdbc.Driver
2 | url = jdbc\:mysql\://localhost\:3306/no183_lab?characterEncoding\=utf-8
3 | username = root
4 | password = 123456
--------------------------------------------------------------------------------
/WebRoot/static/css/equipment/equipment.css:
--------------------------------------------------------------------------------
1 | @CHARSET "UTF-8";
2 | .lab-select {
3 | height: 22px;
4 | line-height: 22px;
5 | }
6 |
7 | .alert {
8 | width: 80%;
9 | margin: 20px auto;
10 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/exception/UserException.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.exception;
2 |
3 | public class UserException extends Exception{
4 |
5 | private static final long serialVersionUID = 2148601445614406221L;
6 |
7 | public UserException(String string) {
8 | super(string);
9 | }
10 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/pojo/LabPermission.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.pojo;
2 |
3 | import javax.annotation.Resource;
4 |
5 | @Resource(name="labPermission")
6 | public class LabPermission {
7 | private static final int Administrator = 99;
8 | private static final int Student = 3;
9 | private static final int GoodsReceipt = 4;
10 | private static final int Teacher = 5;
11 | }
12 |
--------------------------------------------------------------------------------
/WebRoot/static/css/lab/user_message.css:
--------------------------------------------------------------------------------
1 | @CHARSET "UTF-8";
2 |
3 | * {
4 | margin: 0;
5 | padding: 0;
6 | font-size: 14px;
7 | }
8 |
9 | .form-control {
10 | width: 40%;
11 | display: inline-block;
12 | }
13 |
14 | .userinfo {
15 | width: 80%;
16 | margin: 70px auto;
17 | }
18 |
19 | td {
20 | vertical-align: middle !important;
21 | }
22 |
23 | .table .message-input {
24 | font-family: Tahoma, Verdana, 宋体;
25 | font-size: 12px;
26 | line-height: 15px;
27 | color: #000000;
28 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/services/LabService.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.services;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 |
6 | import top.yjzloveyzh.common.pojo.Lab;
7 | import top.yjzloveyzh.common.pojo.User;
8 |
9 | public interface LabService {
10 | public List getLabs();
11 |
12 | /**
13 | * 根据实验室进行统计信息。
14 | * @param user
15 | * @param labId
16 | * @return 关于统计信息的Map集合
17 | */
18 | public Map statisticsById(User user, String labId);
19 | }
20 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/dao/LabDao.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.dao;
2 |
3 | import java.util.List;
4 |
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import top.yjzloveyzh.common.pojo.Lab;
8 | import top.yjzloveyzh.common.pojo.LabEquipmentCount;
9 |
10 | public interface LabDao {
11 | public List getLab();
12 |
13 | public List getStatisticsInfo(@Param("labId") int labId);
14 |
15 | public int getLabEquipmentTotalCount(@Param("labId") int labId);
16 |
17 | public Lab getLabInfoById(@Param("labId") int labId);
18 | }
19 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/utils/PermissionUtil.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.utils;
2 |
3 | import java.util.List;
4 |
5 | import top.yjzloveyzh.common.pojo.Permission;
6 |
7 | public class PermissionUtil {
8 |
9 | public static boolean hasPermission(List permissions, String permission) {
10 |
11 | for (Permission permissionItem : permissions) {
12 |
13 | if (permissionItem.getName().equals(permission)) {
14 |
15 | return true;
16 | }
17 | }
18 |
19 | return false;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/mybatis-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/dao/LabUserDao.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.dao;
2 |
3 | import org.apache.ibatis.annotations.Param;
4 |
5 | import top.yjzloveyzh.common.pojo.User;
6 |
7 | public interface LabUserDao {
8 |
9 | public long insertLabUser(User user);
10 |
11 | public User findUserByUserName(String username);
12 |
13 | public User findUserById(int id);
14 |
15 | public int editByUser(User user);
16 |
17 | public int updateUserToken(@Param("id") int id, @Param("token") String token);
18 |
19 | public String getUserToken(int id);
20 |
21 | public String getTokenByUsername(String username);
22 | }
--------------------------------------------------------------------------------
/WebRoot/static/js/approvement/approve_buy_record.js:
--------------------------------------------------------------------------------
1 | $('#myModal').on('show.bs.modal', function (event) {
2 | var button = $(event.relatedTarget) // Button that triggered the modal
3 | var recipient = button.data('whatever') // Extract info from data-* attributes
4 | // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
5 | // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
6 | var modal = $(this)
7 | modal.find('.modal-title').text('New message to ' + recipient)
8 | modal.find('.modal-body input').val(recipient)
9 | })
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/dao/MySqlSessionDaoSupport.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.dao;
2 |
3 | import javax.annotation.Resource;
4 |
5 | import org.apache.ibatis.session.SqlSessionFactory;
6 | import org.mybatis.spring.support.SqlSessionDaoSupport;
7 | import org.springframework.stereotype.Repository;
8 |
9 | @Repository(value = "mySqlSessionFactory")
10 | public class MySqlSessionDaoSupport extends SqlSessionDaoSupport {
11 |
12 | @Resource(name="sqlSessionFactoryBean")
13 | @Override
14 | public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
15 | super.setSqlSessionFactory(sqlSessionFactory);
16 | }
17 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/services/DeletedRecordService.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.services;
2 |
3 | import top.yjzloveyzh.common.exception.RecordException;
4 | import top.yjzloveyzh.common.pojo.DeletedRecord;
5 | import top.yjzloveyzh.common.pojo.Pagination;
6 | import top.yjzloveyzh.common.pojo.User;
7 |
8 | public interface DeletedRecordService {
9 |
10 | /**
11 | * @param user
12 | * @param keyword
13 | * @param currentPage
14 | * @param orderBy
15 | * @return
16 | * @throws RecordException
17 | */
18 | Pagination getPaginationDeletedRecord(User user, String keyword, String currentPage, String orderBy) throws RecordException;
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/pojo/Permission.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.pojo;
2 |
3 | public class Permission {
4 | private int id;
5 | private String name;
6 | private int roleId;
7 |
8 | public Permission() {
9 | }
10 |
11 | public int getId() {
12 | return id;
13 | }
14 |
15 | public void setId(int id) {
16 | this.id = id;
17 | }
18 |
19 | public String getName() {
20 | return name;
21 | }
22 |
23 | public void setName(String name) {
24 | this.name = name;
25 | }
26 |
27 | public int getRoleId() {
28 | return roleId;
29 | }
30 |
31 | public void setRoleId(int roleId) {
32 | this.roleId = roleId;
33 | }
34 | }
--------------------------------------------------------------------------------
/WebRoot/static/css/approvement/request_buy_record_detail.css:
--------------------------------------------------------------------------------
1 | @CHARSET "UTF-8";
2 |
3 | * {
4 | margin: 0px;
5 | padding: 0px;
6 | font-size: 14px;
7 | }
8 |
9 | .content {
10 | margin-top: 70px;
11 | height: 100%;
12 | padding-bottom: 140px;
13 | }
14 |
15 | .breadcrumb {
16 | margin-left: 10%;
17 | width: 80%;
18 | margin: 0 auto;
19 | }
20 |
21 | .buy-equipment-table {
22 | width: 60%;
23 | margin: 0 auto;
24 | margin-top: 30px;
25 | }
26 |
27 | .td-input {
28 | width: 80%;
29 | }
30 |
31 | .text-left {
32 | text-align: left !important;
33 | }
34 |
35 | .opeartion-btns {
36 | margin-top: 20px;
37 | }
38 |
39 | .ml {
40 | margin-left: 15px;
41 | }
42 |
43 | .alert {
44 | width: 80%;
45 | margin: 20px auto;
46 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/dao/DeletedRecordDao.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.dao;
2 |
3 | import java.util.List;
4 |
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import top.yjzloveyzh.common.pojo.DeletedRecord;
8 |
9 | public interface DeletedRecordDao {
10 |
11 | public int insertDeletedRecordByRecord(DeletedRecord record);
12 |
13 | public int getDeletedRecordCount(@Param("keyword") String keyword, @Param("requestUserId") int requestUserId);
14 |
15 | public List getDeletedRecordPagination(
16 | @Param("keyword") String keyword,
17 | @Param("start") int start,
18 | @Param("offset") int offset,
19 | @Param("orderBy") String orderBy,
20 | @Param("requestUserId") int requestUserId
21 | );
22 | }
23 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/pojo/LabEquipmentCount.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.pojo;
2 |
3 | public class LabEquipmentCount {
4 | String equipmentName;
5 | int count;
6 |
7 | public LabEquipmentCount() {
8 | }
9 |
10 | public String getEquipmentName() {
11 | return equipmentName;
12 | }
13 |
14 | public int getCount() {
15 | return count;
16 | }
17 |
18 | public void setEquipmentName(String equipmentName) {
19 | this.equipmentName = equipmentName;
20 | }
21 |
22 | public void setCount(int count) {
23 | this.count = count;
24 | }
25 |
26 | @Override
27 | public String toString() {
28 | return "{name:\'" + equipmentName + "\', value:\'" + count + "\'}";
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/WebRoot/static/js/login/login.js:
--------------------------------------------------------------------------------
1 | function checkUser() {
2 | var username = document.getElementById("username").value;
3 | var password = document.getElementById("password").value;
4 | if (username == null || username.trim() == "") {
5 | document.getElementById("errorTips").style.display = "block";
6 | var message = "用户名不能为空";
7 | $("#errorMessage").html(message);
8 | $("#username").focus();
9 |
10 | return false;
11 | }
12 |
13 | if (password == null || password.trim() == "") {
14 | document.getElementById("errorTips").style.display = "block";
15 | var message = "密码不能为空";
16 | $("#errorMessage").html(message);
17 | $("#password").focus();
18 |
19 | return false;
20 | }
21 |
22 | return true;
23 | }
--------------------------------------------------------------------------------
/WebRoot/static/css/images/check-box-outline-blank.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/utils/StringUtil.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.utils;
2 |
3 | public class StringUtil {
4 | public static boolean isEmpty(String param) {
5 |
6 | if (param == null || "".equals(param.trim())) {
7 |
8 | return true;
9 | } else {
10 |
11 | return false;
12 | }
13 | }
14 |
15 | public static boolean isNotEmpty(String param) {
16 |
17 | if (param != null && !"".equals(param.trim())) {
18 |
19 | return true;
20 | } else {
21 |
22 | return false;
23 | }
24 | }
25 |
26 | public static String setNullToEmpty(String param) {
27 |
28 | if (isEmpty(param)) {
29 | return "";
30 | } else {
31 | return param;
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/WebRoot/static/css/images/check-box.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ######################################################################
2 | # Build Tools
3 |
4 | .gradle
5 | /build/
6 | !gradle/wrapper/gradle-wrapper.jar
7 |
8 | target/
9 | !.mvn/wrapper/maven-wrapper.jar
10 |
11 | out/
12 |
13 | ######################################################################
14 | # IDE
15 |
16 | ### STS ###
17 | .apt_generated
18 | .classpath
19 | .factorypath
20 | .project
21 | .settings
22 | .springBeans
23 |
24 | ### IntelliJ IDEA ###
25 | .idea
26 | *.iws
27 | *.iml
28 | *.ipr
29 |
30 | ### NetBeans ###
31 | nbproject/private/
32 | build/*
33 | nbbuild/
34 | dist/
35 | nbdist/
36 | .nb-gradle/
37 |
38 | ######################################################################
39 | # Others
40 | *.log
41 | *.xml.versionsBackup
42 | *.swp
43 |
44 | !*/build/*.java
45 | !*/build/*.html
46 | !*/build/*.xml
47 |
--------------------------------------------------------------------------------
/WebRoot/static/js/record/buy-record.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 | $(".search-btn").on("click", function() {
3 | $("#searchForm").submit();
4 | });
5 |
6 | $(document).keyup(function(event) {
7 | if(event.keyCode == 13) {
8 | $("#searchForm").submit();
9 | }
10 | });
11 |
12 | $(".record-buy-record").on("click", function() {
13 | $(location).attr('href', path + '/approvement/r/buy-record');
14 | });
15 |
16 | $(".approve-buy-record").on("click", function() {
17 | $(location).attr('href', path + '/approvement/m/buy-record');
18 | });
19 | });
20 |
21 | function toDeletedRecord() {
22 | document.location.href = path + "/record/delete-record";
23 | }
24 |
25 | function toBuyRecord() {
26 | document.location.href = path + "/record/buy-record";
27 | }
28 |
--------------------------------------------------------------------------------
/WebRoot/static/css/images/add.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/WebRoot/index.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2 | <%
3 | String path = request.getContextPath();
4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5 | %>
6 |
7 |
8 |
9 |
10 |
11 | Welcome
12 |
13 |
14 |
15 |
16 |
17 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/exception/EquipmentException.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.exception;
2 |
3 | public class EquipmentException extends Exception{
4 |
5 | private static final long serialVersionUID = 7484041367089813273L;
6 | private String errorCode;
7 | private String message;
8 |
9 | public EquipmentException(String errorCode, String message) {
10 | super(message);
11 | this.errorCode = errorCode;
12 | this.message = message;
13 | }
14 |
15 | public String getErrorCode() {
16 | return errorCode;
17 | }
18 |
19 | @Override
20 | public String getMessage() {
21 | return message;
22 | }
23 |
24 | public void setErrorCode(String errorCode) {
25 | this.errorCode = errorCode;
26 | }
27 |
28 | public void setMessage(String message) {
29 | this.message = message;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/exception/RecordException.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package top.yjzloveyzh.common.exception;
5 |
6 | public class RecordException extends Exception{
7 | private static final long serialVersionUID = 7484041367089813273L;
8 | private String errorCode;
9 | private String message;
10 |
11 | public RecordException(String errorCode, String message) {
12 | super(message);
13 | this.errorCode = errorCode;
14 | this.message = message;
15 | }
16 |
17 | public String getErrorCode() {
18 | return errorCode;
19 | }
20 |
21 | @Override
22 | public String getMessage() {
23 | return message;
24 | }
25 |
26 | public void setErrorCode(String errorCode) {
27 | this.errorCode = errorCode;
28 | }
29 |
30 | public void setMessage(String message) {
31 | this.message = message;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/dao/EquipmentDao.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.dao;
2 |
3 | import java.util.List;
4 |
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import top.yjzloveyzh.common.pojo.Equipment;
8 | import top.yjzloveyzh.common.pojo.RequestEquipment;
9 |
10 | public interface EquipmentDao {
11 | public int insertRequestEquipment(RequestEquipment requestEquipment);
12 |
13 | public List getByPagination(
14 | @Param("keyword") String keyword,
15 | @Param("start") int start,
16 | @Param("offset") int offset,
17 | @Param("labId") int labId,
18 | @Param("orderBy") String orderBy
19 | );
20 |
21 | public int getCountBySearchWord(
22 | @Param("keyword") String keyword,
23 | @Param("labId") int labId
24 | );
25 |
26 | public int insertEquipment(Equipment equipment);
27 |
28 | public int deleteEquipmentByIdArray(@Param("idArray") int[] idArray, @Param("deleteRecordId") int deleteRecordId);
29 | }
30 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/pojo/Role.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.pojo;
2 |
3 | import java.util.List;
4 |
5 | public class Role {
6 | private int id;
7 | private String name;
8 | private List permissions;
9 |
10 | public Role() {
11 | super();
12 | }
13 |
14 | public int getId() {
15 | return id;
16 | }
17 |
18 | public void setId(int id) {
19 | this.id = id;
20 | }
21 |
22 | public String getName() {
23 | return name;
24 | }
25 |
26 | public void setName(String name) {
27 | this.name = name;
28 | }
29 |
30 | public List getPermissions() {
31 | return permissions;
32 | }
33 |
34 | public void setPermissions(List permissions) {
35 | this.permissions = permissions;
36 | }
37 |
38 | @Override
39 | public String toString() {
40 | return "Role [id=" + id + ", name=" + name + ", permissions=" + permissions + "]";
41 | }
42 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/services/UserService.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.services;
2 |
3 | import javax.servlet.http.HttpServletRequest;
4 | import javax.servlet.http.HttpServletResponse;
5 | import javax.servlet.http.HttpSession;
6 |
7 | import top.yjzloveyzh.common.exception.UserException;
8 | import top.yjzloveyzh.common.pojo.User;
9 |
10 | public interface UserService {
11 |
12 | public User login(User user, String rememberMe, HttpServletResponse response) throws UserException;
13 |
14 | public void register(User user) throws UserException;
15 |
16 | public User getUserById(int id);
17 |
18 | public int updateUser(int id, String gender, String name, String province,
19 | String city, String area, String cellphone, String zipCode, String address, String email) throws UserException;
20 |
21 | public User loginByCookie(HttpServletRequest request, HttpServletResponse response);
22 |
23 | public void logout(HttpSession session, HttpServletRequest request, HttpServletResponse response);
24 | }
--------------------------------------------------------------------------------
/WebRoot/static/css/lab/lab_info.css:
--------------------------------------------------------------------------------
1 | @CHARSET "UTF-8";
2 |
3 | .record-right-body {
4 | padding: 30px !important;
5 | }
6 |
7 | .info {
8 | border-left: 4px solid #37ab2f;
9 | padding-left: 15px;
10 | font-size: 18px;
11 | }
12 |
13 | .info {
14 | margin-top: 25px;
15 | margin-bottom: 15px;
16 | }
17 |
18 | .rm-margin-top {
19 | margin-top: 0px;
20 | }
21 |
22 | .lab-info-body .dt, .da {
23 | font-size: 14px;
24 | height: 40px;
25 | line-height: 40px;
26 | }
27 |
28 | .lab-info-body .dt{
29 | color: #888;
30 | }
31 |
32 | .lab-info-body .mt{
33 | margin-left: 60px;
34 | }
35 |
36 | .lab-info-body .da{
37 | margin-left: 30px;
38 | }
39 |
40 | .lab-info-body .db{
41 | font-size: 14px;
42 | text-indent: 25px;
43 | display: block;
44 | }
45 |
46 | .lab-date-body {
47 | width: 100%;
48 | height: 400px;
49 | margin: 0 auto;
50 | }
51 |
52 | .num {
53 | color: #000;
54 | font-size: 18px;
55 | line-height: 40px;
56 | padding-left: 15px;
57 | }
58 |
59 | .record-left-ul a{
60 | text-decoration: none;
61 | color: #000;
62 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/utils/MD5Util.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.utils;
2 |
3 | import java.math.BigInteger;
4 | import java.security.MessageDigest;
5 | import java.security.NoSuchAlgorithmException;
6 |
7 | public class MD5Util {
8 | public static String md5(String plainText) {
9 | // 定义一个字节数组
10 | byte[] secretBytes = null;
11 | try {
12 | // 生成一个MD5加密计算摘要
13 | MessageDigest md = MessageDigest.getInstance("MD5");
14 | // 对字符串进行加密
15 | md.update(plainText.getBytes());
16 | // 获得加密后的数据
17 | secretBytes = md.digest();
18 | } catch (NoSuchAlgorithmException e) {
19 | throw new RuntimeException("没有md5这个算法!");
20 | }
21 | // 将加密后的数据转换为16进制数字
22 | String md5code = new BigInteger(1, secretBytes).toString(16);// 16进制数字
23 | // 如果生成数字未满32位,需要前面补0
24 |
25 | for (int i = 0; i < 32 - md5code.length(); i++) {
26 | md5code = "0" + md5code;
27 | }
28 |
29 | return md5code;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/dao/impl/LabDaoImpl.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.dao.impl;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.stereotype.Repository;
6 |
7 | import top.yjzloveyzh.common.pojo.Lab;
8 | import top.yjzloveyzh.common.pojo.LabEquipmentCount;
9 | import top.yjzloveyzh.dao.LabDao;
10 | import top.yjzloveyzh.dao.MySqlSessionDaoSupport;
11 |
12 | @Repository(value = "labDaoImpl")
13 | public class LabDaoImpl extends MySqlSessionDaoSupport implements LabDao{
14 |
15 | @Override
16 | public List getLab() {
17 | return getSqlSession().getMapper(LabDao.class).getLab();
18 | }
19 |
20 | @Override
21 | public List getStatisticsInfo(int labId) {
22 |
23 | return getSqlSession().getMapper(LabDao.class).getStatisticsInfo(labId);
24 | }
25 |
26 | @Override
27 | public int getLabEquipmentTotalCount(int labId) {
28 |
29 | return getSqlSession().getMapper(LabDao.class).getLabEquipmentTotalCount(labId);
30 | }
31 |
32 | @Override
33 | public Lab getLabInfoById(int labId) {
34 |
35 | return getSqlSession().getMapper(LabDao.class).getLabInfoById(labId);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/WebRoot/static/css/images/details.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/WebRoot/static/js/equipment/equipment.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 | $(".search-btn").on("click", function() {
3 | $("#searchForm").submit();
4 | });
5 |
6 | $(document).keyup(function(event) {
7 | if(event.keyCode == 13) {
8 | $("#searchForm").submit();
9 | }
10 | });
11 |
12 | $(".delete-btn").on("click", function() {
13 | if ($("input[type='checkbox']:checked").length > 0) {
14 | $("#myModal").modal('show');
15 | }
16 | });
17 |
18 | $(".confirm-delete-btn").on("click", function() {
19 | if ($("input[type='checkbox']:checked").length > 0) {
20 | $('#equipmentDeletedForm').submit();
21 | $("#myModal").modal('hide');
22 | }
23 | });
24 | });
25 |
26 | function changeUrlById(id) {
27 | document.location.href = path + "/lab/info?labId=" + id;
28 | }
29 |
30 | function checkDeleteBox(imgId, checkBoxId) {
31 | if ($('#' + checkBoxId).is(":checked")) {
32 | $('#' + imgId).attr('src', path + '/static/css/images/check-box-outline-blank.svg');
33 | } else {
34 | $('#' + imgId).attr('src', path + '/static/css/images/check-box.svg');
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/web/filter/CharacterEncodingFilter.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.web.filter;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.servlet.Filter;
6 | import javax.servlet.FilterChain;
7 | import javax.servlet.FilterConfig;
8 | import javax.servlet.ServletException;
9 | import javax.servlet.ServletRequest;
10 | import javax.servlet.ServletResponse;
11 | import javax.servlet.annotation.WebFilter;
12 |
13 |
14 | /**
15 | * Servlet Filter implementation class CharacterEncodingFilter
16 | */
17 | @WebFilter("/*")
18 | public class CharacterEncodingFilter implements Filter {
19 |
20 | public CharacterEncodingFilter() {
21 | }
22 |
23 | @Override
24 | public void destroy() {
25 | }
26 |
27 | @Override
28 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
29 | request.setCharacterEncoding("UTF-8");
30 | response.setCharacterEncoding("UTF-8");
31 | response.setContentType("text/html;charset=utf-8");
32 | chain.doFilter(request, response);
33 | }
34 |
35 | @Override
36 | public void init(FilterConfig fConfig) throws ServletException {
37 | }
38 |
39 | }
--------------------------------------------------------------------------------
/WebRoot/static/js/approvement/approve_buy_record_detail.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function(){
2 |
3 | $('.agree-btn').on('click', function () {
4 | $.ajax({
5 | url: path + "/approvement/m/buy-record/approve",
6 | type: "post",
7 | data: {
8 | id: $('.record-id').val().toString(),
9 | operation: '1'
10 | },
11 | success: function (data) {
12 | if (data.code == '200') {
13 | $(".alert").attr("class", "alert alert-success");
14 | $(".alert").html("审批成功.");
15 | $('html, body').animate({scrollTop: 0},'slow');
16 | } else {
17 | $(".alert").attr("class", "alert alert-danger");
18 | $(".alert").html("审批失败.");
19 | $('html, body').animate({scrollTop: 0},'slow');
20 | }
21 | },
22 | error: function () {
23 | $(".alert").attr("class", "alert alert-danger");
24 | $(".alert").html("输入信息有误,请检查后再提交。");
25 | $('html, body').animate({scrollTop: 0},'slow');
26 | }
27 | });
28 | });
29 | });
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/dao/impl/DeletedRecordDaoImpl.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.dao.impl;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.stereotype.Service;
6 |
7 | import top.yjzloveyzh.common.pojo.DeletedRecord;
8 | import top.yjzloveyzh.dao.DeletedRecordDao;
9 | import top.yjzloveyzh.dao.MySqlSessionDaoSupport;
10 |
11 | @Service(value="deletedRecordDaoImpl")
12 | public class DeletedRecordDaoImpl extends MySqlSessionDaoSupport implements DeletedRecordDao{
13 |
14 | @Override
15 | public int insertDeletedRecordByRecord(DeletedRecord record) {
16 |
17 | return getSqlSession().getMapper(DeletedRecordDao.class).insertDeletedRecordByRecord(record);
18 | }
19 |
20 | @Override
21 | public int getDeletedRecordCount(String keyword, int requestUserId) {
22 |
23 | return getSqlSession().getMapper(DeletedRecordDao.class).getDeletedRecordCount(keyword, requestUserId);
24 | }
25 |
26 | @Override
27 | public List getDeletedRecordPagination(String keyword, int start, int offset, String orderBy, int requestUserId) {
28 |
29 | return getSqlSession().getMapper(DeletedRecordDao.class).getDeletedRecordPagination(keyword, start, offset, orderBy, requestUserId);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 183.实验室智能化管理系统
2 |
3 | - 完整代码获取地址:从戎源码网 ([https://armycodes.com/](https://armycodes.com/))
4 | - 技术探讨、资料分享,请加QQ群:692619798
5 | - 作者微信:19941326836 QQ:952045282
6 | - 承接计算机毕业设计、Java毕业设计、Python毕业设计、深度学习、机器学习
7 | - 选题+开题报告+任务书+程序定制+安装调试+论文+答辩ppt 一条龙服务
8 | - 所有选题地址 ([https://github.com/YuLin-Coder/AllProjectCatalog](https://github.com/YuLin-Coder/AllProjectCatalog))
9 |
10 | ## 项目介绍
11 | 基于ssm的实验室智能化管理系统【含报告】:前端 jsp、jquery、bootstrap,后端 maven、springmvc、spring、mybatis;集成审批管理、实验室设备、设备统计等功能于一体的系统。
12 |
13 | ## 功能介绍
14 |
15 | - 基本功能:登录,注册,退出
16 | - 网站首页:主导航栏,轮播图,通知公告,业务处理
17 | - 记录查询:购置记录查询,删除记录删除,关键词搜索
18 | - 审批管理:购置审批查询,审批购置记录查询,关键词搜索
19 | - 个人信息管理:个人信息查看与修改
20 | - 实验室设备:设备列表查询,删除
21 | - 设备统计:生物实验室、化学实验室、数学实验室、计科实验室、物联网实验室、物理实验室
22 |
23 | ## 环境
24 |
25 | - IntelliJ IDEA 2021.3
26 |
27 | - Mysql 5.7.26
28 |
29 | - Tomcat 7.0.73
30 |
31 | - JDK 1.8
32 |
33 | ## 运行截图
34 |
35 | 
36 |
37 | 
38 |
39 | 
40 |
41 | 
42 |
43 | 
44 |
45 | 
46 |
47 | 
48 |
49 | 
50 |
51 | 
52 |
--------------------------------------------------------------------------------
/src/log4j.properties:
--------------------------------------------------------------------------------
1 | ### \u8BBE\u7F6E###
2 | log4j.rootLogger = debug,stdout,D,E
3 | ### \u8F93\u51FA\u4FE1\u606F\u5230\u63A7\u5236\u62AC ###
4 | log4j.appender.stdout = org.apache.log4j.ConsoleAppender
5 | log4j.appender.stdout.Target = System.out
6 | log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
7 | log4j.appender.stdout.layout.ConversionPattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n
8 | ### \u8F93\u51FADEBUG \u7EA7\u522B\u4EE5\u4E0A\u7684\u65E5\u5FD7\u5230=E://logs/error.log ###
9 | log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
10 | log4j.appender.D.File = E://logs/lab/log.log
11 | log4j.appender.D.Append = true
12 | log4j.appender.D.Threshold = DEBUG
13 | log4j.appender.D.layout = org.apache.log4j.PatternLayout
14 | log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
15 | ### \u8F93\u51FAERROR \u7EA7\u522B\u4EE5\u4E0A\u7684\u65E5\u5FD7\u5230=E://logs/error.log ###
16 | log4j.appender.E = org.apache.log4j.DailyRollingFileAppender
17 | log4j.appender.E.File =E\://logs/lab/error.log
18 | log4j.appender.E.Append = true
19 | log4j.appender.E.Threshold = ERROR
20 | log4j.appender.E.layout = org.apache.log4j.PatternLayout
21 | log4j.appender.E.layout.ConversionPattern =%-d{yyyy-MM-dd HH\:mm\:ss} [ %t\:%r ] - [ %p ] %m%n
--------------------------------------------------------------------------------
/WebRoot/static/css/equipment/request_buy_equipment.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0px;
3 | padding: 0px;
4 | font-size: 14px;
5 | }
6 |
7 | .content {
8 | margin-top: 70px;
9 | height: 100%;
10 | padding-bottom: 140px;
11 | }
12 |
13 | .table-div {
14 | width: 80%;
15 | margin: 0 auto;
16 | }
17 |
18 | .table-title {
19 | display: block;
20 | height: 45px;
21 | padding-left: 10px;
22 | background-color: #0ccff2;
23 | }
24 |
25 | .table-title span {
26 | font-size: 18px;
27 | font-weight: bold;
28 | line-height: 45px;
29 | }
30 |
31 | .breadcrumb {
32 | margin-left: 10%;
33 | width: 80%;
34 | }
35 |
36 | .table-add-div {
37 | width: 80%;
38 | margin: 7px auto;
39 | }
40 |
41 | .btn-circle {
42 | width: 30px;
43 | height: 30px;
44 | float: right;
45 | cursor: pointer;
46 | }
47 |
48 | .commit-div {
49 | height: 60px;
50 | width: 80%;
51 | margin: 45px auto;
52 | text-align: center;
53 | }
54 |
55 | .btn-commit {
56 | margin-left: 30px;
57 | }
58 |
59 | .delete-img {
60 | width: 22px;
61 | height: 22px;
62 | cursor: pointer;
63 | }
64 |
65 | .buy-equipment-table {
66 | width: 80%;
67 | margin-left: 10%;
68 | margin-top: 50px;
69 | }
70 |
71 | .text-left {
72 | text-align: left !important;
73 | }
74 |
75 | .alert {
76 | width: 80%;
77 | margin: 0 auto;
78 | }
79 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/utils/PropertyUtil.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.utils;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStream;
5 | import java.util.Properties;
6 |
7 | import top.yjzloveyzh.common.Constants;
8 |
9 | public class PropertyUtil {
10 |
11 | private static Properties properties = null;
12 |
13 | static {
14 | InputStream in = null;
15 |
16 | try {
17 | in = PropertyUtil.class.getClassLoader().getResourceAsStream(Constants.General.PROPERTY_APP_FILE_NAME);
18 | properties = new Properties();
19 | properties.load(in);
20 | } catch (IOException e) {
21 | e.printStackTrace();
22 | } finally {
23 | if (in != null) {
24 | try {
25 | in.close();
26 | } catch (IOException e) {
27 | e.printStackTrace();
28 | }
29 | }
30 | }
31 | }
32 |
33 | public static String getProperty(String key) {
34 | return properties.getProperty(key);
35 | }
36 |
37 | public static String getRequestBuyRecordPerPageCount() {
38 | String count = properties.getProperty(Constants.Properties.PROPERTIES_KEY_REQUEST_BUY_RECORD_PER_PAGE_COUNT);
39 |
40 | return count;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/services/EquipmentService.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.services;
2 |
3 | import java.util.Map;
4 |
5 | import top.yjzloveyzh.common.exception.EquipmentException;
6 | import top.yjzloveyzh.common.pojo.Equipment;
7 | import top.yjzloveyzh.common.pojo.Pagination;
8 | import top.yjzloveyzh.common.pojo.User;
9 |
10 | public interface EquipmentService {
11 |
12 | /**
13 | * 申请购置设备
14 | * @param equipments
15 | * @param user
16 | * @throws EquipmentException
17 | */
18 | public void requestBuyEquipment(Map equipments, User user) throws EquipmentException;
19 |
20 | /**
21 | * 根据当前页,以及搜索内容还有排序顺序进行显示设备列表
22 | * @param searchKeyWord
23 | * @param page
24 | * @param orderBy
25 | * @param labId
26 | * @param user
27 | * @return 分好页的设备列表
28 | * @throws EquipmentException
29 | */
30 | public Pagination listEquipmentsByPagination(String searchKeyWord, String page, String orderBy, String labId, User user) throws EquipmentException;
31 |
32 | public int insertEquipmentByEquipment(Equipment equipment, User user) throws EquipmentException;
33 |
34 | /**
35 | * @param user
36 | * @param deletedIds
37 | * @return
38 | * @throws EquipmentException
39 | */
40 | int deleteEquipmentByIdArray(User user, String[] deletedIds) throws EquipmentException;
41 | }
42 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/utils/CookieUtil.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package top.yjzloveyzh.common.utils;
5 |
6 | import javax.servlet.http.Cookie;
7 | import javax.servlet.http.HttpServletRequest;
8 | import javax.servlet.http.HttpServletResponse;
9 |
10 | import top.yjzloveyzh.common.Constants;
11 |
12 | /**
13 | * @author 171882105@qq.com
14 | */
15 | public class CookieUtil {
16 |
17 | public static void addCookie(HttpServletResponse response, String name, String value) {
18 | Cookie cookie = new Cookie(name.trim(), value.trim());
19 | cookie.setMaxAge(Constants.Cookie.COOKIE_TIME_EXIST);
20 | cookie.setPath("/");
21 | response.addCookie(cookie);
22 | }
23 |
24 | public static void removeCookie(HttpServletResponse response, String name) {
25 | Cookie uid = new Cookie(name, null);
26 | uid.setPath("/");
27 | uid.setMaxAge(0);
28 | response.addCookie(uid);
29 | }
30 |
31 | public static String getCookie(HttpServletRequest request, String cookieName) {
32 | Cookie cookies[] = request.getCookies();
33 |
34 | if (cookies != null) {
35 | for (Cookie cookie : cookies) {
36 |
37 | if (cookie.getName().equals(cookieName)) {
38 |
39 | return cookie.getValue();
40 | }
41 | }
42 | }
43 | return null;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/pojo/DeletedRecord.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.pojo;
2 |
3 | import java.util.Date;
4 |
5 | public class DeletedRecord {
6 | private int id;
7 | private int userId;
8 | private Date createdAt;
9 | private Date updatedAt;
10 | private boolean isDeleted;
11 | private User user;
12 |
13 | public DeletedRecord() {
14 | }
15 |
16 | public int getId() {
17 | return id;
18 | }
19 |
20 | public int getUserId() {
21 | return userId;
22 | }
23 |
24 | public Date getCreatedAt() {
25 | return createdAt;
26 | }
27 |
28 | public Date getUpdatedAt() {
29 | return updatedAt;
30 | }
31 |
32 | public boolean isDeleted() {
33 | return isDeleted;
34 | }
35 |
36 | public User getUser() {
37 | return user;
38 | }
39 |
40 | public void setId(int id) {
41 | this.id = id;
42 | }
43 |
44 | public void setUserId(int userId) {
45 | this.userId = userId;
46 | }
47 |
48 | public void setCreatedAt(Date createdAt) {
49 | this.createdAt = createdAt;
50 | }
51 |
52 | public void setUpdatedAt(Date updatedAt) {
53 | this.updatedAt = updatedAt;
54 | }
55 |
56 | public void setDeleted(boolean isDeleted) {
57 | this.isDeleted = isDeleted;
58 | }
59 |
60 | public void setUser(User user) {
61 | this.user = user;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/springMVC-servlet.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/pojo/Lab.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.pojo;
2 |
3 | import java.util.Date;
4 |
5 | public class Lab {
6 | private int id;
7 | private String name;
8 | private User manager;
9 | private int userId;
10 | private Date updatedAt;
11 | private Date createdAt;
12 | private String brief;
13 |
14 | public Lab() {
15 | }
16 |
17 | public int getId() {
18 | return id;
19 | }
20 |
21 | public String getName() {
22 | return name;
23 | }
24 |
25 | public User getManager() {
26 | return manager;
27 | }
28 |
29 | public void setId(int id) {
30 | this.id = id;
31 | }
32 |
33 | public void setName(String name) {
34 | this.name = name;
35 | }
36 |
37 | public void setManager(User manager) {
38 | this.manager = manager;
39 | }
40 |
41 | public int getUserId() {
42 | return userId;
43 | }
44 |
45 | public void setUserId(int userId) {
46 | this.userId = userId;
47 | }
48 |
49 | public Date getUpdatedAt() {
50 | return updatedAt;
51 | }
52 |
53 | public Date getCreatedAt() {
54 | return createdAt;
55 | }
56 |
57 | public void setUpdatedAt(Date updatedAt) {
58 | this.updatedAt = updatedAt;
59 | }
60 |
61 | public void setCreatedAt(Date createdAt) {
62 | this.createdAt = createdAt;
63 | }
64 |
65 | public String getBrief() {
66 | return brief;
67 | }
68 |
69 | public void setBrief(String brief) {
70 | this.brief = brief;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/dao/impl/LabUserDaoImpl.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.dao.impl;
2 |
3 | import org.springframework.stereotype.Repository;
4 |
5 | import top.yjzloveyzh.common.pojo.User;
6 | import top.yjzloveyzh.dao.LabUserDao;
7 | import top.yjzloveyzh.dao.MySqlSessionDaoSupport;
8 |
9 |
10 | @Repository(value="labUserDaoImpl")
11 | public class LabUserDaoImpl extends MySqlSessionDaoSupport implements LabUserDao {
12 |
13 | @Override
14 | public long insertLabUser(User user) {
15 |
16 | getSqlSession().getMapper(LabUserDao.class).insertLabUser(user);
17 | return user.getId();
18 | }
19 |
20 | @Override
21 | public User findUserByUserName(String username) {
22 |
23 | return getSqlSession().getMapper(LabUserDao.class).findUserByUserName(username);
24 | }
25 |
26 | @Override
27 | public User findUserById(int id) {
28 |
29 | return getSqlSession().getMapper(LabUserDao.class).findUserById(id);
30 | }
31 |
32 | @Override
33 | public int editByUser(User user) {
34 | return getSqlSession().getMapper(LabUserDao.class).editByUser(user);
35 | }
36 |
37 | @Override
38 | public int updateUserToken(int id, String token) {
39 | return getSqlSession().getMapper(LabUserDao.class).updateUserToken(id, token);
40 | }
41 |
42 | @Override
43 | public String getUserToken(int id) {
44 | return getSqlSession().getMapper(LabUserDao.class).getUserToken(id);
45 | }
46 |
47 | @Override
48 | public String getTokenByUsername(String username) {
49 | return getSqlSession().getMapper(LabUserDao.class).getTokenByUsername(username);
50 | }
51 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/dao/impl/EquipmentDaoImpl.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.dao.impl;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.stereotype.Repository;
6 |
7 | import top.yjzloveyzh.common.pojo.Equipment;
8 | import top.yjzloveyzh.common.pojo.RequestEquipment;
9 | import top.yjzloveyzh.dao.EquipmentDao;
10 | import top.yjzloveyzh.dao.MySqlSessionDaoSupport;
11 |
12 | @Repository(value="equipmentDaoImpl")
13 | public class EquipmentDaoImpl extends MySqlSessionDaoSupport implements EquipmentDao{
14 |
15 | @Override
16 | public int insertRequestEquipment(RequestEquipment requestEquipment) {
17 | int id = getSqlSession().getMapper(EquipmentDao.class).insertRequestEquipment(requestEquipment);
18 |
19 | return id;
20 | }
21 |
22 | @Override
23 | public List getByPagination(String keyword, int start, int offset, int labId, String orderBy) {
24 |
25 | return getSqlSession().getMapper(EquipmentDao.class).getByPagination(keyword, start, offset, labId, orderBy);
26 | }
27 |
28 | @Override
29 | public int getCountBySearchWord(String keyword, int labId) {
30 |
31 | return getSqlSession().getMapper(EquipmentDao.class).getCountBySearchWord(keyword, labId);
32 | }
33 |
34 | @Override
35 | public int insertEquipment(Equipment equipment) {
36 |
37 | return getSqlSession().getMapper(EquipmentDao.class).insertEquipment(equipment);
38 | }
39 |
40 |
41 | @Override
42 | public int deleteEquipmentByIdArray(int[] idArray, int deleteRecordId) {
43 |
44 | return getSqlSession().getMapper(EquipmentDao.class).deleteEquipmentByIdArray(idArray, deleteRecordId);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/services/RecordService.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.services;
2 |
3 | import top.yjzloveyzh.common.exception.EquipmentException;
4 | import top.yjzloveyzh.common.exception.RecordException;
5 | import top.yjzloveyzh.common.pojo.Pagination;
6 | import top.yjzloveyzh.common.pojo.RequestBuyRecord;
7 | import top.yjzloveyzh.common.pojo.User;
8 |
9 | public interface RecordService {
10 | public Pagination getPaginationRequestBuyRecord(
11 | User user,
12 | String keyword,
13 | String currentPage,
14 | String orderBy
15 | ) throws RecordException;
16 |
17 | public Pagination getNotReplyRequestBuyRecord(
18 | User user,
19 | String keyword,
20 | String currentPage,
21 | String orderBy
22 | ) throws RecordException;
23 |
24 | public RequestBuyRecord findRequestBuyRecordById(String id) throws RecordException;
25 |
26 | public RequestBuyRecord findRepliedBuyRecordById(String id) throws RecordException;
27 |
28 | /**
29 | * @param id
30 | * @param operation
31 | * @param user
32 | * @return
33 | * @throws RecordException
34 | * @throws EquipmentException
35 | */
36 | int approveRequestBuyRecord(String id, String operation, User user) throws RecordException, EquipmentException;
37 |
38 | /**
39 | * 获取已经答复了的购置记录
40 | * @param user
41 | * @param keyword
42 | * @param currentPage
43 | * @param orderBy
44 | * @return
45 | * @throws RecordException
46 | */
47 | Pagination getRepliedRequestBuyRecord(User user, String keyword, String currentPage, String orderBy) throws RecordException;
48 | }
49 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/pojo/RequestEquipment.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.pojo;
2 |
3 | public class RequestEquipment {
4 | int id;
5 | String name;
6 | int count;
7 | double price;
8 | int labId;
9 | String origin;
10 | int requestBuyRecordId;
11 | Lab lab;
12 |
13 | public RequestEquipment() {
14 | }
15 |
16 | public int getId() {
17 | return id;
18 | }
19 |
20 | public String getName() {
21 | return name;
22 | }
23 |
24 | public int getCount() {
25 | return count;
26 | }
27 |
28 | public double getPrice() {
29 | return price;
30 | }
31 |
32 | public int getLabId() {
33 | return labId;
34 | }
35 |
36 | public String getOrigin() {
37 | return origin;
38 | }
39 |
40 | public void setId(int id) {
41 | this.id = id;
42 | }
43 |
44 | public void setName(String name) {
45 | this.name = name;
46 | }
47 |
48 | public void setCount(int count) {
49 | this.count = count;
50 | }
51 |
52 | public void setPrice(double price) {
53 | this.price = price;
54 | }
55 |
56 | public void setLabId(int labId) {
57 | this.labId = labId;
58 | }
59 |
60 | public void setOrigin(String origin) {
61 | this.origin = origin;
62 | }
63 |
64 | public int getRequestBuyRecordId() {
65 | return requestBuyRecordId;
66 | }
67 |
68 | public void setRequestBuyRecordId(int requestBuyRecordId) {
69 | this.requestBuyRecordId = requestBuyRecordId;
70 | }
71 |
72 | public Lab getLab() {
73 | return lab;
74 | }
75 |
76 | public void setLab(Lab lab) {
77 | this.lab = lab;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/WebRoot/static/css/images/operation.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/utils/PaginationUtil.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package top.yjzloveyzh.common.utils;
5 |
6 | import java.util.ArrayList;
7 | import java.util.LinkedList;
8 | import java.util.List;
9 |
10 | import top.yjzloveyzh.common.Constants;
11 |
12 | /**
13 | * @author 171882105@qq.com
14 | *
15 | */
16 | public class PaginationUtil {
17 |
18 | public static List makePageIndexList(int currentPageIndex, int perPageDateCount, int totalPageCount) {
19 |
20 | int maxPageListLength = 7;
21 | int maxPages = (int) Math.ceil(totalPageCount * 1.0 / perPageDateCount);
22 |
23 | try {
24 | maxPageListLength = Integer.parseInt(PropertyUtil.getProperty(Constants.Properties.PROPERTIES_KEY_PAGINATION_CHOOSE_LIST));
25 | } catch (NumberFormatException numberFormatException) {
26 |
27 | }
28 |
29 | LinkedList pageLinkedList = new LinkedList();
30 |
31 | if (currentPageIndex > totalPageCount || currentPageIndex <= 0) {
32 |
33 | return new ArrayList(pageLinkedList);
34 | } else if(totalPageCount <= 7) {
35 |
36 | for (int i = 0; i < totalPageCount; i++) {
37 | pageLinkedList.add(i + 1);
38 | }
39 |
40 | return new ArrayList(pageLinkedList);
41 | } else {
42 | pageLinkedList.add(currentPageIndex);
43 | int left = currentPageIndex - 1;
44 | int right = currentPageIndex + 1;
45 |
46 | while (pageLinkedList.size() < maxPageListLength) {
47 |
48 | if (pageLinkedList.size() < maxPageListLength && left > 0) {
49 | pageLinkedList.addFirst(left--);
50 | }
51 |
52 | if (pageLinkedList.size() < maxPageListLength && right <= totalPageCount) {
53 | pageLinkedList.addLast(right++);
54 | }
55 | }
56 |
57 | return new ArrayList(pageLinkedList);
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/pojo/Pagination.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.pojo;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 |
6 | public class Pagination {
7 | private List results;
8 | private List pagesList;
9 | private int totalCount; // 总记录数
10 | private int totalPage; // 总页数
11 | private int currentPage;
12 | private int orderBy;
13 | private Map extra;
14 |
15 | String searchKeyWord;
16 |
17 | public Pagination() {
18 | super();
19 | }
20 |
21 | public List getResults() {
22 | return results;
23 | }
24 |
25 | public List getPagesList() {
26 | return pagesList;
27 | }
28 |
29 | public int getTotalCount() {
30 | return totalCount;
31 | }
32 |
33 | public int getTotalPage() {
34 | return totalPage;
35 | }
36 |
37 | public int getCurrentPage() {
38 | return currentPage;
39 | }
40 |
41 | public String getSearchKeyWord() {
42 | return searchKeyWord;
43 | }
44 |
45 | public void setResults(List results) {
46 | this.results = results;
47 | }
48 |
49 | public void setPagesList(List pagesList) {
50 | this.pagesList = pagesList;
51 | }
52 |
53 | public void setTotalCount(int totalCount) {
54 | this.totalCount = totalCount;
55 | }
56 |
57 | public void setTotalPage(int totalPage) {
58 | this.totalPage = totalPage;
59 | }
60 |
61 | public void setCurrentPage(int currentPage) {
62 | this.currentPage = currentPage;
63 | }
64 |
65 | public void setSearchKeyWord(String searchKeyWord) {
66 | this.searchKeyWord = searchKeyWord;
67 | }
68 |
69 | public int getOrderBy() {
70 | return orderBy;
71 | }
72 |
73 | public void setOrderBy(int orderBy) {
74 | this.orderBy = orderBy;
75 | }
76 |
77 | public Map getExtra() {
78 | return extra;
79 | }
80 |
81 | public void setExtra(Map extra) {
82 | this.extra = extra;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/WebRoot/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | ilab
7 |
8 | index.html
9 | index.htm
10 | index.jsp
11 | default.html
12 | default.htm
13 | default.jsp
14 |
15 |
16 |
17 |
18 |
19 | contextConfigLocation
20 | classpath:applicationContext.xml
21 |
22 |
23 |
24 |
25 | org.springframework.web.context.ContextLoaderListener
26 |
27 |
28 |
29 | SessionFilter
30 | top.yjzloveyzh.web.filter.SessionFilter
31 |
32 | notNeedLoginPages
33 | ,user/toLogin,lab/toContent,user/toRegister,user/login,user/register
34 |
35 |
36 |
37 |
38 | SessionFilter
39 | /*
40 |
41 |
42 |
43 | springMVC
44 | org.springframework.web.servlet.DispatcherServlet
45 |
46 | contextConfigLocation
47 | classpath:springMVC-servlet.xml
48 |
49 | 1
50 |
51 |
52 |
53 | springMVC
54 | /
55 |
56 |
57 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/controller/DeletedRecordController.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.controller;
2 |
3 | import javax.servlet.http.HttpServletRequest;
4 | import javax.servlet.http.HttpSession;
5 |
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.stereotype.Controller;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 |
11 | import top.yjzloveyzh.common.Constants;
12 | import top.yjzloveyzh.common.exception.RecordException;
13 | import top.yjzloveyzh.common.pojo.DeletedRecord;
14 | import top.yjzloveyzh.common.pojo.Pagination;
15 | import top.yjzloveyzh.common.pojo.User;
16 | import top.yjzloveyzh.services.DeletedRecordService;
17 | import top.yjzloveyzh.services.RecordService;
18 | import top.yjzloveyzh.services.UserService;
19 |
20 | @Controller
21 | @RequestMapping(value = "/record")
22 | public class DeletedRecordController {
23 |
24 | @Qualifier(value="recordServiceImpl")
25 | @Autowired
26 | RecordService recordService;
27 |
28 | @Qualifier(value="deletedRecordServiceImpl")
29 | @Autowired
30 | DeletedRecordService deletedRecordService;
31 |
32 | @Qualifier(value="userServiceImpl")
33 | @Autowired
34 | UserService userService;
35 |
36 | @RequestMapping("/delete-record")
37 | public String toDeletedRecord(String searchKeyWord, String page, String orderBy, HttpSession session, HttpServletRequest request) {
38 |
39 | try {
40 | Pagination pagination = deletedRecordService.getPaginationDeletedRecord(
41 | (User)session.getAttribute(Constants.User.SESSION_USER_KEY), searchKeyWord, page, orderBy
42 | );
43 |
44 | request.setAttribute(Constants.RecordController.REQUEST_ATTRIBUTE_KEY_REQUEST_BUY_RECORD, pagination);
45 | } catch (RecordException recordException) {
46 |
47 | if (recordException.getErrorCode().equals(Constants.ErrorCode.ERROR_USER_NOT_EXIST)) {
48 |
49 | return "redirect:/user/toLogin";
50 | }
51 | }
52 |
53 | return "record/deleted_record";
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/pojo/Equipment.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.pojo;
2 |
3 | import java.util.Date;
4 |
5 | public class Equipment {
6 | int id;
7 | String name;
8 | double price;
9 | int labId;
10 | String origin;
11 | Date createdAt;
12 | Date updatedAt;
13 | int requestBuyRecordId;
14 |
15 | boolean isDeleted;
16 | Lab lab;
17 |
18 | public Equipment() {
19 | }
20 |
21 | public int getId() {
22 | return id;
23 | }
24 |
25 | public String getName() {
26 | return name;
27 | }
28 |
29 | public double getPrice() {
30 | return price;
31 | }
32 |
33 | public int getLabId() {
34 | return labId;
35 | }
36 |
37 | public String getOrigin() {
38 | return origin;
39 | }
40 |
41 | public void setId(int id) {
42 | this.id = id;
43 | }
44 |
45 | public void setName(String name) {
46 | this.name = name;
47 | }
48 |
49 | public void setPrice(double price) {
50 | this.price = price;
51 | }
52 |
53 | public void setLabId(int labId) {
54 | this.labId = labId;
55 | }
56 |
57 | public void setOrigin(String origin) {
58 | this.origin = origin;
59 | }
60 |
61 | public Date getCreatedAt() {
62 | return createdAt;
63 | }
64 |
65 | public Date getUpdatedAt() {
66 | return updatedAt;
67 | }
68 |
69 | public void setCreatedAt(Date createdAt) {
70 | this.createdAt = createdAt;
71 | }
72 |
73 | public void setUpdatedAt(Date updatedAt) {
74 | this.updatedAt = updatedAt;
75 | }
76 |
77 | public boolean isDeleted() {
78 | return isDeleted;
79 | }
80 |
81 | public void setDeleted(boolean isDeleted) {
82 | this.isDeleted = isDeleted;
83 | }
84 |
85 | public Lab getLab() {
86 | return lab;
87 | }
88 |
89 | public void setLab(Lab lab) {
90 | this.lab = lab;
91 | }
92 |
93 | public int getRequestBuyRecordId() {
94 | return requestBuyRecordId;
95 | }
96 |
97 | public void setRequestBuyRecordId(int requestBuyRecordId) {
98 | this.requestBuyRecordId = requestBuyRecordId;
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/controller/LabController.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.controller;
2 |
3 | import java.util.Map;
4 |
5 | import javax.servlet.http.HttpServletRequest;
6 | import javax.servlet.http.HttpServletResponse;
7 | import javax.servlet.http.HttpSession;
8 |
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.beans.factory.annotation.Qualifier;
11 | import org.springframework.stereotype.Controller;
12 | import org.springframework.web.bind.annotation.RequestMapping;
13 | import org.springframework.web.bind.annotation.ResponseBody;
14 |
15 | import top.yjzloveyzh.common.Constants;
16 | import top.yjzloveyzh.common.pojo.User;
17 | import top.yjzloveyzh.services.LabService;
18 | import top.yjzloveyzh.services.UserService;
19 |
20 | @Controller
21 | @RequestMapping("/lab")
22 | public class LabController {
23 |
24 | @Qualifier(value = "userServiceImpl")
25 | @Autowired
26 | UserService userService;
27 |
28 | @Qualifier(value = "labServiceImpl")
29 | @Autowired
30 | LabService labService;
31 |
32 | @RequestMapping("/toContent")
33 | public String toContent(HttpSession session, HttpServletRequest request, HttpServletResponse response) {
34 |
35 | User user = userService.loginByCookie(request, response);
36 |
37 | if (user != null) {
38 | user.setPassword("");
39 | session.setAttribute(Constants.User.SESSION_USER_KEY, user);
40 | }
41 |
42 | return "lab/content";
43 | }
44 |
45 | @RequestMapping("/info")
46 | public String toInfo(HttpSession session, HttpServletRequest request, HttpServletResponse response, String labId) {
47 |
48 | User user = (User) session.getAttribute(Constants.User.SESSION_USER_KEY);
49 |
50 | Map labInfo = labService.statisticsById(user, labId);
51 |
52 | request.setAttribute("labInfo", labInfo);
53 |
54 | return "lab/lab_info";
55 | }
56 |
57 | @RequestMapping("/ajax/info")
58 | public @ResponseBody Map toLabInfoAjax(HttpSession session, HttpServletRequest request, HttpServletResponse response, String labId) {
59 |
60 | User user = (User) session.getAttribute(Constants.User.SESSION_USER_KEY);
61 |
62 | Map labInfo = labService.statisticsById(user, labId);
63 |
64 | return labInfo;
65 | }
66 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/dao/RecordDao.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.dao;
2 |
3 | import java.util.List;
4 |
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import top.yjzloveyzh.common.pojo.RequestBuyRecord;
8 |
9 | public interface RecordDao {
10 | public int insertRequestRecordByRecord(RequestBuyRecord record);
11 |
12 | public List getRequestBuyRecordPagination(
13 | @Param("keyword") String keyword,
14 | @Param("start") int start,
15 | @Param("offset") int offset,
16 | @Param("orderBy") String orderBy,
17 | @Param("requestUserId") int requestUserId
18 | );
19 |
20 | public int getRequestBuyRecordCount(@Param("keyword") String keyword, @Param("requestUserId") int requestUserId);
21 |
22 | /**
23 | * 获取还未审批的申请购置记录, 要求根据时间来进行排序, 默认从近到远。
24 | * @param keyword 搜索关键词
25 | * @param start 起始index
26 | * @param offset 数据偏移量
27 | * @param orderBy 根据什么排序, 0 正序, 1 倒序
28 | * @return 申请购置记录的列表
29 | */
30 | public List getNotReplyRequestBuyRecordPagination(
31 | @Param("keyword") String keyword,
32 | @Param("start") int start,
33 | @Param("offset") int offset,
34 | @Param("orderBy") String orderBy
35 | );
36 |
37 | /**
38 | * get the all have not replied request-buy-record rows count by keyword.
39 | * @param keyword
40 | * @return the request-buy-record count
41 | */
42 | public int getNotReplyAllRequestBuyRecordCount(@Param("keyword") String keyword);
43 |
44 | public RequestBuyRecord findRequestBuyRecordById(int id);
45 |
46 | public RequestBuyRecord findRepliedBuyRecordById(int id);
47 |
48 | /**
49 | * 审批申请购置的表
50 | * @param id 表的Id
51 | * @param opearation 参数 0: 进行中, 1: 审批, -1: 拒绝
52 | * @return 修改记录条数
53 | */
54 | public int updateRequestBuyRecordAllowedById(@Param("recordId")int id, @Param("operation")int operation, @Param("allow_user_id") int allowUserId);
55 |
56 | /**
57 | * @param keyword
58 | * @return
59 | */
60 | int getRepliedRequestBuyRecordCount(String keyword);
61 |
62 | public List getRepliedRequestBuyRecordPagination(
63 | @Param("keyword") String keyword,
64 | @Param("start") int start,
65 | @Param("offset") int offset,
66 | @Param("orderBy") String orderBy
67 | );
68 | }
69 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/mapper/DeleteRecordMappper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 | INSERT INTO delete_record(user_id, created_at, updated_at)
7 | VALUES(#{userId}, NOW(), NOW())
8 |
9 |
10 |
20 |
21 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/WebRoot/static/css/lab/content.css:
--------------------------------------------------------------------------------
1 | @CHARSET "UTF-8";
2 |
3 | .notice {
4 | overflow: hidden;
5 | background-color: #fff;
6 | border-radius: 5px;
7 | border: 1px solid #c9c9c9;
8 | }
9 |
10 | .ywcl {
11 | overflow: hidden;
12 | }
13 |
14 | .notice {
15 | padding: 15px 15px;
16 | height: 300px;
17 | }
18 |
19 | .notice-board {
20 | font-size: 18px;
21 | color: rgb(102, 102, 102);
22 | font-family: 微软雅黑, arial;
23 | margin-left: 20px;
24 | }
25 |
26 | .notice .bd {
27 | padding-bottom: 20px;
28 | height: 400px;
29 | }
30 |
31 | .notice .bd ul {
32 | }
33 |
34 | .notice .bd ul li {
35 | border-bottom: 1px dashed #d8d8d8;
36 | list-style-type: none;
37 | }
38 |
39 | .intmc {
40 | float: left;
41 | width: 65%;
42 | height: 32px;
43 | line-height: 32px;
44 | border: 0 solid;
45 | overflow: hidden;
46 | }
47 |
48 | .intmc a {
49 | font-size: 14px;
50 | color: #4c4c4c;
51 | float: left;
52 | margin-left: 15px;
53 | text-decoration: none;
54 | }
55 |
56 | .intim {
57 | float: left;
58 | width: 25%;
59 | height: 32px;
60 | line-height: 32px;
61 | color: #4c4c4c;
62 | font-size: 14px;
63 | border: 0 solid;
64 | margin-right: 5%;
65 | overflow: hidden;
66 | }
67 |
68 | .notice-more {
69 | float: right;
70 | }
71 |
72 | .notice-more a {
73 | color: gray;
74 | border-bottom-style: solid;
75 | border-bottom: 1px solid #d8d8d8;
76 | }
77 |
78 | .ywcl {
79 | overflow: hidden;
80 | background-color: #fff;
81 | border-radius: 5px;
82 | border: 1px solid #c9c9c9;
83 | }
84 |
85 | hr {
86 | margin-left: 20px;
87 | text-align: left;
88 | background-color: #000;
89 | width: 40%;
90 | color: #000;
91 | }
92 |
93 | .ywcl-btn {
94 | height: 40px;
95 | width:80%;
96 | margin-left:10%;
97 | background-color: #8DB3E5;
98 | border-radius: 10px;
99 | cursor: pointer;
100 | margin-top: 10px;
101 | text-align: center;
102 | }
103 |
104 | .ywcl-btn label {
105 | -webkit-user-select: none;
106 | -khtml-user-select: none;
107 | -moz-user-select: none;
108 | -ms-user-select: none;
109 | user-select: none;
110 | font-size:19px;
111 | font-family:楷体 ;
112 | text-align: center;
113 | line-height: 40px;
114 | vertical-align: middle;
115 | cursor: pointer;
116 | }
117 |
118 | .ywcl-btn label a {
119 | color: #000;
120 | text-decoration: none;
121 | }
122 |
123 | .img-responsive {
124 | min-height: 400px;
125 | max-height: 400px;
126 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/controller/RecordController.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.controller;
2 |
3 | import javax.servlet.http.HttpServletRequest;
4 | import javax.servlet.http.HttpSession;
5 |
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.stereotype.Controller;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.ResponseBody;
11 |
12 | import top.yjzloveyzh.common.Constants;
13 | import top.yjzloveyzh.common.exception.RecordException;
14 | import top.yjzloveyzh.common.pojo.Pagination;
15 | import top.yjzloveyzh.common.pojo.RequestBuyRecord;
16 | import top.yjzloveyzh.common.pojo.User;
17 | import top.yjzloveyzh.services.RecordService;
18 | import top.yjzloveyzh.services.UserService;
19 |
20 | @Controller
21 | @RequestMapping(value = "/record")
22 | public class RecordController {
23 |
24 | @Qualifier(value="recordServiceImpl")
25 | @Autowired
26 | RecordService recordService;
27 |
28 | @Qualifier(value="userServiceImpl")
29 | @Autowired
30 | UserService userService;
31 |
32 | @RequestMapping("/buy-record")
33 | public String toBuyRecord(String searchKeyWord, String page, String orderBy, HttpSession session, HttpServletRequest request) {
34 |
35 | try {
36 | Pagination pagination = recordService.getPaginationRequestBuyRecord(
37 | (User)session.getAttribute(Constants.User.SESSION_USER_KEY), searchKeyWord, page, orderBy
38 | );
39 |
40 | request.setAttribute(Constants.RecordController.REQUEST_ATTRIBUTE_KEY_REQUEST_BUY_RECORD, pagination);
41 | } catch (RecordException recordException) {
42 |
43 | if (recordException.getErrorCode().equals(Constants.ErrorCode.ERROR_USER_NOT_EXIST)) {
44 |
45 | return "redirect:/user/toLogin";
46 | }
47 | }
48 |
49 | return "record/request_buy_record";
50 | }
51 |
52 | @RequestMapping("/test")
53 | public @ResponseBody Object test(HttpSession session) throws RecordException {
54 |
55 | // Pagination pagination = recordService.getPaginationRequestBuyRecord((User)session.getAttribute(Constants.User.SESSION_USER_KEY), "", "1", "1");
56 |
57 | // return pagination;
58 | Pagination notReplyRequestBuyRecord = recordService.getNotReplyRequestBuyRecord((User)session.getAttribute(Constants.User.SESSION_USER_KEY), "", "1", "1");
59 | User user = (User) session.getAttribute(Constants.User.SESSION_USER_KEY);
60 | return notReplyRequestBuyRecord;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/web/filter/SessionFilter.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package top.yjzloveyzh.web.filter;
5 |
6 | import java.io.IOException;
7 |
8 | import javax.servlet.Filter;
9 | import javax.servlet.FilterChain;
10 | import javax.servlet.FilterConfig;
11 | import javax.servlet.ServletException;
12 | import javax.servlet.ServletRequest;
13 | import javax.servlet.ServletResponse;
14 | import javax.servlet.http.HttpServletRequest;
15 | import javax.servlet.http.HttpServletResponse;
16 | import javax.servlet.http.HttpSession;
17 |
18 | import top.yjzloveyzh.common.Constants;
19 | import top.yjzloveyzh.common.pojo.User;
20 |
21 | public class SessionFilter implements Filter {
22 |
23 | private String notNeedLoginPages = "";
24 | protected FilterConfig filterConfig;
25 |
26 | @Override
27 | public void init(FilterConfig filterConfig) throws ServletException {
28 | this.filterConfig = filterConfig;
29 |
30 | if(filterConfig.getInitParameter("notNeedLoginPages") != null) {
31 | notNeedLoginPages = filterConfig.getInitParameter("notNeedLoginPages");
32 | }
33 | }
34 |
35 | @Override
36 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
37 | HttpServletRequest request = (HttpServletRequest)servletRequest;
38 | HttpServletResponse response = (HttpServletResponse)servletResponse;
39 | String uri = request.getRequestURI();
40 | String requestedUri = uri.substring(request.getContextPath().length() + 1);
41 |
42 | if (requestedUri.indexOf(".") > 0) {
43 | filterChain.doFilter(request, response);
44 | } else {
45 | String [] pages = notNeedLoginPages.split(",");
46 | boolean isAllow = false;
47 |
48 | for (String page : pages) {
49 |
50 | if (page.equals(requestedUri)) {
51 | isAllow = true;
52 | break;
53 | }
54 | }
55 |
56 | if (isAllow) {
57 | filterChain.doFilter(request, response);
58 | } else {
59 | HttpSession session = request.getSession();
60 | User user = (User)session.getAttribute(Constants.User.SESSION_USER_KEY);
61 |
62 | if (user == null) {
63 | response.sendRedirect(request.getContextPath() + "/user/toLogin");
64 | } else {
65 | filterChain.doFilter(request, response);
66 | }
67 | }
68 | }
69 | }
70 |
71 | @Override
72 | public void destroy() {
73 | this.notNeedLoginPages = null;
74 | }
75 | }
--------------------------------------------------------------------------------
/WebRoot/WEB-INF/jsp/lab/header.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
3 | <%
4 | String path = request.getContextPath();
5 | String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
6 | + path + "/";
7 | %>
8 |
9 |
10 |
11 |
12 |
13 | Header
14 |
15 |
16 |
17 |
18 |
19 |
20 |
29 |
30 |
31 |
32 |
71 |
72 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/mapper/LabMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
24 |
25 |
35 |
36 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/WebRoot/static/css/images/delete.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/dao/impl/RecordDaoImpl.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.dao.impl;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.stereotype.Repository;
6 |
7 | import top.yjzloveyzh.common.pojo.RequestBuyRecord;
8 | import top.yjzloveyzh.dao.MySqlSessionDaoSupport;
9 | import top.yjzloveyzh.dao.RecordDao;
10 |
11 | @Repository(value="recordDaoImpl")
12 | public class RecordDaoImpl extends MySqlSessionDaoSupport implements RecordDao {
13 |
14 | @Override
15 | public int insertRequestRecordByRecord(RequestBuyRecord record) {
16 |
17 | return getSqlSession().getMapper(RecordDao.class).insertRequestRecordByRecord(record);
18 | }
19 |
20 | @Override
21 | public List getRequestBuyRecordPagination(String keyword, int start, int offset, String orderBy, int requestUserId) {
22 |
23 | return getSqlSession().getMapper(RecordDao.class).getRequestBuyRecordPagination(keyword, start, offset, orderBy, requestUserId);
24 | }
25 |
26 | @Override
27 | public int getRequestBuyRecordCount(String keyword, int requestUserId) {
28 |
29 | return getSqlSession().getMapper(RecordDao.class).getRequestBuyRecordCount(keyword, requestUserId);
30 | }
31 |
32 | @Override
33 | public List getNotReplyRequestBuyRecordPagination(String keyword, int start, int offset, String orderBy) {
34 |
35 | return getSqlSession().getMapper(RecordDao.class).getNotReplyRequestBuyRecordPagination(keyword, start, offset, orderBy);
36 | }
37 |
38 | @Override
39 | public int getNotReplyAllRequestBuyRecordCount(String keyword) {
40 |
41 | return getSqlSession().getMapper(RecordDao.class).getNotReplyAllRequestBuyRecordCount(keyword);
42 | }
43 |
44 | @Override
45 | public int getRepliedRequestBuyRecordCount(String keyword) {
46 |
47 | return getSqlSession().getMapper(RecordDao.class).getRepliedRequestBuyRecordCount(keyword);
48 | }
49 |
50 | @Override
51 | public RequestBuyRecord findRequestBuyRecordById(int id) {
52 |
53 | return getSqlSession().getMapper(RecordDao.class).findRequestBuyRecordById(id);
54 | }
55 |
56 | @Override
57 | public int updateRequestBuyRecordAllowedById(int id, int opearation, int allowUserId) {
58 |
59 | return getSqlSession().getMapper(RecordDao.class).updateRequestBuyRecordAllowedById(id, opearation, allowUserId);
60 | }
61 |
62 | @Override
63 | public List getRepliedRequestBuyRecordPagination(String keyword, int start, int offset, String orderBy) {
64 |
65 | return getSqlSession().getMapper(RecordDao.class).getRepliedRequestBuyRecordPagination(keyword, start, offset, orderBy);
66 | }
67 |
68 | @Override
69 | public RequestBuyRecord findRepliedBuyRecordById(int id) {
70 |
71 | return getSqlSession().getMapper(RecordDao.class).findRepliedBuyRecordById(id);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/Constants.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common;
2 |
3 | public class Constants {
4 |
5 | public static class General {
6 | public static final String PROPERTY_APP_FILE_NAME = "app.properties";
7 | }
8 |
9 | public static class User {
10 | public static final String SESSION_USER_KEY = "USER";
11 | public static final String USER_INFO = "userInfo";
12 | }
13 |
14 | public static class Cookie {
15 | public static final String COOKIE_KEY_REMEMBER_ME = "rememberMe";
16 | public static final String COOKIE_KEY_TOKEN = "token";
17 | public static final String COOKIE_KEY_USERNAME = "username";
18 | public static final int COOKIE_TIME_EXIST = 60 * 60 * 24 * 10;
19 | }
20 |
21 | public static class EquipmentController {
22 | public static final String KEY_REQUEST_BUY_EQUIPMENTS_JSON = "equipments";
23 | public static final String KEY_LABS= "labs";
24 | }
25 |
26 | public static class UserControllerUrl {
27 | public static final String USER_CONTROLLER_URL_LOGIN = "login";
28 | public static final String USER_CONTROLLER_URL_TO_LOGIN = "toLogin";
29 | public static final String USER_CONTROLLER_URL_REGISTER = "register";
30 | public static final String USER_CONTROLLER_LOGIN_PAGE_URL = "login/login";
31 | }
32 |
33 | public static class RecordController {
34 | public static final String REQUEST_ATTRIBUTE_KEY_REQUEST_BUY_RECORD = "pagination";
35 | }
36 |
37 | public static class LabControllerUrl {
38 | public static final String LAB_CONTROLLER_URL_TO_CONTENT = "toContent";
39 | public static final String LAB_CONTROLLER_CONTENT_PAGE_URL = "lab/content";
40 | }
41 |
42 | public static final class ErrorCode {
43 | public static final String SUCCESS = "200";
44 | public static final String ERROR_USER_NOT_EXIST = "400";
45 | public static final String ERROR_PERMISSION_DENIED = "401";
46 | public static final String ERROR_PARAMETER_ILLEGAL = "403";
47 | public static final String ERROR_RESOURCE_NOT_FOUND = "404";
48 | public static final String ERROR_SERVER_DENIED = "405";
49 | }
50 |
51 | public static final class Code {
52 | public static final String BACK_CODE = "code";
53 | public static final String BACK_TIP = "tip";
54 | }
55 |
56 | public static final class Properties {
57 | public static final String PROPERTIES_KEY_REQUEST_BUY_RECORD_PER_PAGE_COUNT = "request_buy_record_per_page_count";
58 | public static final String PROPERTIES_KEY_PAGINATION_CHOOSE_LIST = "pagination_choose_list";
59 | }
60 |
61 | public static final class LabServicePermission {
62 |
63 | }
64 |
65 | public static final class EquipmentServicePermission {
66 |
67 | }
68 |
69 | public static final class UserServicePermission {
70 |
71 | }
72 | }
--------------------------------------------------------------------------------
/WebRoot/static/css/equipment/table.css:
--------------------------------------------------------------------------------
1 | table {
2 | *border-collapse: collapse; /* IE7 and lower */
3 | border-spacing: 0;
4 | width: 900px;
5 | background-color: #fff;
6 | }
7 |
8 | .bordered {
9 | border: solid #ccc 1px;
10 | -moz-border-radius: 6px;
11 | -webkit-border-radius: 6px;
12 | border-radius: 6px;
13 | -webkit-box-shadow: 0 1px 1px #ccc;
14 | -moz-box-shadow: 0 1px 1px #ccc;
15 | box-shadow: 0 1px 1px #ccc;
16 |
17 | }
18 |
19 | .bordered tr:hover {
20 | background: #fbf8e9;
21 | -o-transition: all 0.1s ease-in-out;
22 | -webkit-transition: all 0.1s ease-in-out;
23 | -moz-transition: all 0.1s ease-in-out;
24 | -ms-transition: all 0.1s ease-in-out;
25 | transition: all 0.1s ease-in-out;
26 | }
27 |
28 | .bordered td, .bordered th {
29 | border-left: 1px solid #ccc;
30 | border-top: 1px solid #ccc;
31 | padding: 10px;
32 | text-align: left;
33 | }
34 |
35 | .bordered th {
36 | background-color: #dce9f9;
37 | background-image: -webkit-gradient(linear, left top, left bottom, from(#ebf3fc), to(#dce9f9));
38 | background-image: -webkit-linear-gradient(top, #ebf3fc, #dce9f9);
39 | background-image: -moz-linear-gradient(top, #ebf3fc, #dce9f9);
40 | background-image: -ms-linear-gradient(top, #ebf3fc, #dce9f9);
41 | background-image: -o-linear-gradient(top, #ebf3fc, #dce9f9);
42 | background-image: linear-gradient(top, #ebf3fc, #dce9f9);
43 | -webkit-box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
44 | -moz-box-shadow:0 1px 0 rgba(255,255,255,.8) inset;
45 | box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
46 | border-top: none;
47 | text-shadow: 0 1px 0 rgba(255,255,255,.5);
48 | text-align: center;
49 | }
50 |
51 | .bordered td:first-child, .bordered th:first-child {
52 | border-left: none;
53 | }
54 |
55 | .bordered td:last-child {
56 | }
57 |
58 | .bordered th:first-child {
59 | -moz-border-radius: 6px 0 0 0;
60 | -webkit-border-radius: 6px 0 0 0;
61 | border-radius: 6px 0 0 0;
62 | }
63 |
64 | .bordered th:last-child {
65 | -moz-border-radius: 0 6px 0 0;
66 | -webkit-border-radius: 0 6px 0 0;
67 | border-radius: 0 6px 0 0;
68 | }
69 |
70 | .bordered th:only-child{
71 | -moz-border-radius: 6px 6px 0 0;
72 | -webkit-border-radius: 6px 6px 0 0;
73 | border-radius: 6px 6px 0 0;
74 | }
75 |
76 | .bordered tr:last-child td:first-child {
77 | -moz-border-radius: 0 0 0 6px;
78 | -webkit-border-radius: 0 0 0 6px;
79 | border-radius: 0 0 0 6px;
80 | }
81 |
82 | .bordered tr:last-child td:last-child {
83 | -moz-border-radius: 0 0 6px 0;
84 | -webkit-border-radius: 0 0 6px 0;
85 | border-radius: 0 0 6px 0;
86 | }
87 |
88 | .input-text {
89 | width: 100%;
90 | height: 50px;
91 | border: 0px;
92 | font-size: 18px;
93 | padding-left: 30px;
94 | }
95 |
96 | .bordered .td-input {
97 | padding: 0px;
98 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/services/impl/LabServiceImpl.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.services.impl;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.beans.factory.annotation.Qualifier;
10 | import org.springframework.stereotype.Service;
11 |
12 | import top.yjzloveyzh.common.pojo.Lab;
13 | import top.yjzloveyzh.common.pojo.LabEquipmentCount;
14 | import top.yjzloveyzh.common.pojo.User;
15 | import top.yjzloveyzh.dao.LabDao;
16 | import top.yjzloveyzh.services.LabService;
17 |
18 | @Service(value = "labServiceImpl")
19 | public class LabServiceImpl implements LabService {
20 |
21 | @Qualifier(value = "labDaoImpl")
22 | @Autowired
23 | LabDao labDao;
24 |
25 | @Override
26 | public List getLabs() {
27 | List labs = labDao.getLab();
28 |
29 | return labs;
30 | }
31 |
32 | @Override
33 | public Map statisticsById(User user, String labId) {
34 |
35 | if (labId == null) {
36 | labId = new String();
37 | }
38 |
39 | int id = 0;
40 |
41 | try {
42 | id = Integer.parseInt(labId);
43 | } catch (NumberFormatException numberFormatException) {
44 | }
45 |
46 | List statisticsInfo = labDao.getStatisticsInfo(id);
47 | Map labInfo = new HashMap();
48 | int totalCount = labDao.getLabEquipmentTotalCount(id);
49 | labInfo.put("totalCount", totalCount);
50 |
51 | if (statisticsInfo == null) {
52 |
53 | return null;
54 | } else {
55 | List equipmentNameList = new ArrayList();
56 | List equipmentCountList = new ArrayList();
57 |
58 | for (LabEquipmentCount labEquipmentCount : statisticsInfo) {
59 | equipmentNameList.add("\'" + labEquipmentCount.getEquipmentName() + "\'");
60 | equipmentCountList.add(String.valueOf(labEquipmentCount.getCount()));
61 | totalCount -= labEquipmentCount.getCount();
62 | }
63 |
64 | if (statisticsInfo.size() >= 9 ) {
65 | equipmentNameList.add("\'其他\'");
66 | LabEquipmentCount qita = new LabEquipmentCount();
67 | qita.setCount(totalCount);
68 | qita.setEquipmentName("其他");
69 | statisticsInfo.add(qita);
70 | }
71 |
72 | labInfo.put("names", equipmentNameList.toArray());
73 | labInfo.put("counts", statisticsInfo.toArray());
74 | labInfo.put("labId", id);
75 |
76 | Lab lab = labDao.getLabInfoById(id);
77 | List labList = labDao.getLab();
78 | labInfo.put("lab", lab);
79 | labInfo.put("labs", labList);
80 |
81 | return labInfo;
82 | }
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/services/impl/DeletedRecordServiceImpl.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.services.impl;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.beans.factory.annotation.Qualifier;
7 | import org.springframework.stereotype.Service;
8 |
9 | import top.yjzloveyzh.common.Constants;
10 | import top.yjzloveyzh.common.exception.RecordException;
11 | import top.yjzloveyzh.common.pojo.DeletedRecord;
12 | import top.yjzloveyzh.common.pojo.Pagination;
13 | import top.yjzloveyzh.common.pojo.User;
14 | import top.yjzloveyzh.common.utils.PaginationUtil;
15 | import top.yjzloveyzh.common.utils.PropertyUtil;
16 | import top.yjzloveyzh.dao.DeletedRecordDao;
17 | import top.yjzloveyzh.services.DeletedRecordService;
18 |
19 | @Service(value="deletedRecordServiceImpl")
20 | public class DeletedRecordServiceImpl implements DeletedRecordService {
21 |
22 | @Qualifier(value="deletedRecordDaoImpl")
23 | @Autowired
24 | DeletedRecordDao deletedRecordDao;
25 |
26 | @Override
27 | public Pagination getPaginationDeletedRecord(User user, String keyword, String currentPage, String orderBy) throws RecordException {
28 |
29 | if (user == null) {
30 | throw new RecordException(Constants.ErrorCode.ERROR_USER_NOT_EXIST, "对不起, 请先登录.");
31 | }
32 |
33 | int page = 1;
34 | int order = 1;
35 | int count = 6;
36 |
37 | if (keyword == null) {
38 | keyword = new String();
39 | }
40 |
41 | try {
42 | page = Integer.parseInt(currentPage);
43 |
44 | if (page <= 0) {
45 | page = 1;
46 | }
47 |
48 | } catch (NumberFormatException numberFormatException) {
49 | }
50 |
51 | try {
52 | order = Integer.parseInt(orderBy);
53 | order = order == 0 ? order : 1;
54 | } catch (NumberFormatException e) {
55 | }
56 |
57 | try {
58 | count = Integer.parseInt(PropertyUtil.getRequestBuyRecordPerPageCount());
59 | } catch (NumberFormatException e) {
60 | }
61 |
62 |
63 | Pagination pagination = new Pagination();
64 | pagination.setSearchKeyWord(keyword);
65 | orderBy = order == 0 ? "ASC" : "DESC";
66 |
67 | keyword = "%" + keyword + "%";
68 | int totalCount = deletedRecordDao.getDeletedRecordCount(keyword, user.getId());
69 | int start = (page - 1) * count;
70 | int offset = count;
71 | int maxPage = (int) Math.ceil(totalCount * 1.0 / count);
72 |
73 | if (page > maxPage) {
74 | page = 1;
75 | }
76 | List pageIndexList = PaginationUtil.makePageIndexList(page, count, maxPage);
77 |
78 | pagination.setCurrentPage(page);
79 | pagination.setResults(deletedRecordDao.getDeletedRecordPagination(keyword, start, offset, orderBy, user.getId()));
80 | pagination.setTotalCount(count);
81 | pagination.setTotalPage(maxPage);
82 | pagination.setPagesList(pageIndexList);
83 | pagination.setOrderBy(order);
84 |
85 | return pagination;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/WebRoot/static/js/lab/lab_info.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 |
3 | let option = {
4 | tooltip: {
5 | trigger: 'item',
6 | formatter: "{b}: {c} ({d}%)"
7 | },
8 | legend: {
9 | orient: 'vertical',
10 | x: 'left',
11 | data:['直达','营销广告','搜索引擎','邮件营销','联盟广告','视频广告','百度','谷歌','必应','其他']
12 | },
13 | series: [
14 | {
15 | type:'pie',
16 | radius: ['40%', '55%'],
17 | label: {
18 | normal: {
19 | formatter: '\n {b|{b}:}{c} {per|{d}%} ',
20 | backgroundColor: '#eee',
21 | borderColor: '#aaa',
22 | borderWidth: 1,
23 | borderRadius: 4,
24 | rich: {
25 | a: {
26 | color: '#999',
27 | lineHeight: 22,
28 | align: 'center'
29 | },
30 | hr: {
31 | borderColor: '#aaa',
32 | width: '100%',
33 | borderWidth: 0.5,
34 | height: 0
35 | },
36 | b: {
37 | fontSize: 16,
38 | lineHeight: 33
39 | },
40 | per: {
41 | color: '#eee',
42 | backgroundColor: '#334455',
43 | padding: [2, 4],
44 | borderRadius: 2
45 | }
46 | }
47 | }
48 | },
49 | data:[
50 | ]
51 | }
52 | ]
53 | };
54 |
55 | var labEcharts = echarts.init(document.getElementById("lab-date-body"));
56 | labEcharts.setOption(option);
57 |
58 |
59 | $.ajax({
60 | url: path + "/lab/ajax/info",
61 | type: "get",
62 | data: {
63 | labId: currentLabId
64 | },
65 | success: function (rdata) {
66 |
67 | let labEquipCounts = rdata.counts;
68 | let labEArray = new Array();
69 |
70 | for (let i = 0; i < labEquipCounts.length; i++) {
71 | let equipCount = {};
72 | equipCount.value = labEquipCounts[i].count;
73 | equipCount.name = labEquipCounts[i].equipmentName;
74 | labEArray.unshift(equipCount);
75 | }
76 |
77 | labEcharts.setOption({
78 | // xAxis:{
79 | // data:data.name
80 | // },
81 | series:[
82 | {
83 | data: labEArray
84 | }
85 | ]
86 | })
87 | },
88 | error: function () {
89 | }
90 | });
91 | });
92 |
93 | function changeUrlById(id) {
94 | document.location.href = path + "/lab/info?labId=" + id;
95 | }
96 |
97 | function toEquipmentUrl() {
98 | document.location.href = path + "/equipment/list";
99 | }
--------------------------------------------------------------------------------
/src/applicationContext.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/WebRoot/static/css/login/login.css:
--------------------------------------------------------------------------------
1 | @CHARSET "UTF-8";
2 |
3 | .hidden-important {
4 | display: none;
5 | }
6 |
7 | * {
8 | -moz-user-select:none;/*火狐*/
9 | -webkit-user-select:none;/*webkit浏览器*/
10 | -ms-user-select:none;/*IE10*/
11 | -khtml-user-select:none;/*早期浏览器*/
12 | user-select:none;
13 | font-family: 微软雅黑, arial;
14 | font-size: 14px;
15 | color: rgb(102, 102, 102);
16 | margin: 0px;
17 | padding: 0px;
18 | }
19 |
20 | .content {
21 | height: 100%;
22 | position: relative;
23 | }
24 |
25 | .left-img {
26 | width: 0px;
27 | height: 100%;
28 | float: left;
29 | color: blue;
30 | overflow: hidden;
31 | background-repeat: no-repeat;
32 | }
33 |
34 | .right-login {
35 | width: 100%;
36 | height: 100%;
37 | color: blue;
38 | }
39 |
40 | .login-footer {
41 | margin-top: 45px;
42 | text-align: center;
43 | color :#000000;
44 | }
45 |
46 | .login-form {
47 | margin-top: 50px;
48 | width: 400px;
49 | }
50 |
51 | .login-header span {
52 | height: 18px;
53 | margin-bottom: 0px;
54 | font-family: 微软雅黑, arial;
55 | font-size: 22px;
56 | color: black;
57 | font-weight: bold;
58 | line-height: 18px;
59 | height: 18px;
60 | vertical-align: bottom;
61 | }
62 |
63 | .login-btn {
64 | margin-top: 45px;
65 | height: 50px;
66 | margin-bottom: 35px;
67 | width: 100%;
68 | }
69 |
70 | @media screen and (min-width: 0px) and (max-width: 400px) {
71 | .login-form {
72 | width: 90%;
73 | margin: 20px auto;
74 | }
75 |
76 | .login-header span {
77 | font-size: 18px;
78 | }
79 |
80 | .login-header {
81 | width: 90%;
82 | margin: 0 auto;
83 | }
84 |
85 | .login-btn {
86 | margin-top: 15px;
87 | margin-bottom: 15px;
88 | }
89 | }
90 |
91 | @media screen and (min-width: 400px) and (max-width: 600px) {
92 | .login-form {
93 | width: 400px;
94 | margin: 20px auto;
95 | }
96 |
97 | .login-header {
98 | text-align: center;
99 | }
100 | }
101 |
102 | @media screen and (min-width: 600px) and (max-width: 1199px) {
103 | .left-img {
104 | width: 0px;
105 | }
106 |
107 | .right-login {
108 | width: 100%;
109 | margin: 0 auto;
110 | }
111 |
112 | .login-form {
113 | margin: 50px auto;
114 | }
115 |
116 | .login-header {
117 | text-align: center;
118 | }
119 | }
120 |
121 | @media screen and (min-width: 1200px) {
122 | .left-img {
123 | width: 45%;
124 | }
125 |
126 | .right-login {
127 | width: 50%;
128 | float: right;
129 | }
130 |
131 | .login-footer {
132 | margin-left: 30px;
133 | text-align: left;
134 | }
135 | }
136 |
137 | .left-img img {
138 | width: 100%;
139 | height: 100%;
140 | }
141 |
142 | .login-content {
143 | width: 100%;
144 | margin-top: 20%;
145 | color: black;
146 | }
147 |
148 | .login-header {
149 | height: 60px;
150 | }
151 |
152 | .login-header img {
153 | width: 48px;
154 | height: 48px;
155 | }
156 |
157 | .login-rememRule {
158 | margin-top: 20px;
159 | }
160 |
161 | .tip {
162 | margin-bottom: 15px;
163 | height: 35px;
164 | }
165 |
166 | .errorMessage {
167 | color: #f00;
168 | }
169 |
170 | .errorTips {
171 | border:1px solid red;
172 | border-radius: 2px;
173 | line-height: 35px;
174 | padding-left: 15px;
175 | }
176 |
177 | .password-div {
178 | margin-top: 25px;
179 | }
180 |
181 | .user-operation {
182 | float: right;
183 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/pojo/RequestBuyRecord.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.pojo;
2 |
3 | import java.util.Date;
4 | import java.util.List;
5 |
6 | public class RequestBuyRecord {
7 |
8 | private int id;
9 | private Date createAt;
10 | private Date updateAt;
11 | private Date allowAt;
12 | private boolean isDeleted;
13 | private int isAllowed;
14 | private boolean isDone;
15 | private double cost;
16 | private String title;
17 | private int allowedUserId;
18 | private int requestedUserId;
19 | private User allowedUser;
20 | private User requestedUser;
21 | private List equipments;
22 |
23 | public RequestBuyRecord() {
24 | }
25 |
26 | public int getId() {
27 | return id;
28 | }
29 |
30 | public double getCost() {
31 | return cost;
32 | }
33 |
34 | public User getAllowedUser() {
35 | return allowedUser;
36 | }
37 |
38 | public User getRequestedUser() {
39 | return requestedUser;
40 | }
41 |
42 | public void setId(int id) {
43 | this.id = id;
44 | }
45 |
46 | public void setCost(double cost) {
47 | this.cost = cost;
48 | }
49 |
50 | public void setAllowedUser(User allowedUser) {
51 | this.allowedUser = allowedUser;
52 | }
53 |
54 | public void setRequestedUser(User requestedUser) {
55 | this.requestedUser = requestedUser;
56 | }
57 |
58 | public boolean isDeleted() {
59 | return isDeleted;
60 | }
61 |
62 | public boolean isDone() {
63 | return isDone;
64 | }
65 |
66 | public void setDeleted(boolean isDeleted) {
67 | this.isDeleted = isDeleted;
68 | }
69 |
70 | public int getIsAllowed() {
71 | return isAllowed;
72 | }
73 |
74 | public void setIsAllowed(int isAllowed) {
75 | this.isAllowed = isAllowed;
76 | }
77 |
78 | public void setDone(boolean isDone) {
79 | this.isDone = isDone;
80 | }
81 |
82 | public Date getCreateAt() {
83 | return createAt;
84 | }
85 |
86 | public Date getUpdateAt() {
87 | return updateAt;
88 | }
89 |
90 | public void setCreateAt(Date createAt) {
91 | this.createAt = createAt;
92 | }
93 |
94 | public void setUpdateAt(Date updateAt) {
95 | this.updateAt = updateAt;
96 | }
97 |
98 | public int getAllowedUserId() {
99 | return allowedUserId;
100 | }
101 |
102 | public int getRequestedUserId() {
103 | return requestedUserId;
104 | }
105 |
106 | public void setAllowedUserId(int allowedUserId) {
107 | this.allowedUserId = allowedUserId;
108 | }
109 |
110 | public void setRequestedUserId(int requestedUserId) {
111 | this.requestedUserId = requestedUserId;
112 | }
113 |
114 | public List getEquipments() {
115 | return equipments;
116 | }
117 |
118 | public String getTitle() {
119 | return title;
120 | }
121 |
122 | public void setTitle(String title) {
123 | this.title = title;
124 | }
125 |
126 | public void setEquipments(List equipments) {
127 | this.equipments = equipments;
128 | }
129 |
130 | public Date getAllowAt() {
131 | return allowAt;
132 | }
133 |
134 | public void setAllowAt(Date allowAt) {
135 | this.allowAt = allowAt;
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/WebRoot/static/css/record/request_buy_record.css:
--------------------------------------------------------------------------------
1 | @CHARSET "UTF-8";
2 |
3 | * {
4 | margin: 0px;
5 | padding: 0px;
6 | font-size: 14px;
7 | }
8 |
9 | .content {
10 | margin-top: 70px;
11 | height: 100%;
12 | padding-bottom: 140px;
13 | }
14 |
15 | .breadcrumb {
16 | margin-left: 10%;
17 | width: 80%;
18 | margin: 0 auto;
19 | }
20 |
21 | .record-content {
22 | overflow: hidden;
23 | width: 980px;
24 | height: 100%;
25 | margin: 30px auto 100px;
26 | border: 1px solid #e1e2e5;
27 | box-shadow: 0 2px 4px rgba(0,0,0,.14);
28 | background: #fafafa;
29 | border-radius: 4px;
30 | }
31 |
32 | .record-content .record-right {
33 | float: right;
34 | width: 828px;
35 | border-left: 1px solid #ddd;
36 | min-height: 850px;
37 | background: #fff;
38 | }
39 |
40 | .record-content .record-left {
41 | float: left;
42 | width: 150px;
43 | height: 100%;
44 | overflow: hidden;
45 | }
46 |
47 | .record-content .record-left .record-left-title {
48 | display: block;
49 | width: 150px;
50 | height: 50px;
51 | text-align: center;
52 | line-height: 50px;
53 | font-size: 16px;
54 | color: #99a2aa;
55 | cursor: default;
56 | border-bottom: 1px solid #e1e2e5;
57 | background-color: #eaeaea;
58 | }
59 |
60 | .record-content .record-left .record-left-ul {
61 | list-style: none;
62 | border-bottom: 1px solid #e1e2e5;
63 | display: block;
64 | list-style-type: disc;
65 | }
66 |
67 | .record-content .record-left .record-left-ul .li-list:HOVER {
68 | background: #e1e4ea;
69 | cursor: pointer;
70 | }
71 |
72 | .record-content .record-left .record-left-ul .li-list {
73 | margin: 0px;
74 | padding: 0px;
75 | width: 150px;
76 | height: 48px;
77 | line-height: 48px;
78 | display: list-item;
79 | text-align: -webkit-match-parent;
80 | list-style: none;
81 | text-align: center;
82 | }
83 |
84 | .record-content .record-left .record-left-ul .li-list span {
85 | }
86 |
87 | .record-content .record-right .record-right-title {
88 | height: 50px;
89 | padding-left: 30px;
90 | border-bottom: 1px solid #ddd;
91 | }
92 |
93 | .record-content .record-right .record-right-title .title-b {
94 | width: 4px;
95 | height: 16px;
96 | margin-top: 16px;
97 | background-color: #00a1d6;
98 | border-radius: 4px;
99 | }
100 |
101 | .record-content .record-right .record-right-title .title-content {
102 | margin: 15px 0 0 5px;
103 | color: #00a1d6;
104 | font-size: 14px;
105 | cursor: default;
106 | }
107 |
108 | .record-content .record-right .record-right-body {
109 | padding: 20px 20px 0;
110 | }
111 |
112 | .search-input {
113 | float: right;
114 | width: 220px;
115 | vertical-align: middle;
116 | margin-top: 8px;
117 | margin-right: 30px;
118 | }
119 |
120 | .record-content .record-left .on {
121 | background-color: #00a1d7!important;
122 | color: #fff;
123 | }
124 |
125 | .detail-img {
126 | width: 16px;
127 | height: 16px;
128 | cursor: pointer;
129 | }
130 |
131 | .delete-img {
132 | width: 22px;
133 | height: 22px;
134 | cursor: pointer;
135 | }
136 |
137 | .modal .title-b {
138 | width: 4px;
139 | height: 16px;
140 | background-color: #00a1d6;
141 | border-radius: 4px;
142 | margin-top: 4px;
143 | margin-right: 15px;
144 | }
145 |
146 | .modal .modal-title {
147 | margin: 15px 0 0 5px;
148 | color: #00a1d6;
149 | font-size: 18px;
150 | cursor: default;
151 | }
152 |
153 | .record-left-ul {
154 | margin-bottom: 0px;
155 | }
156 |
157 | table {
158 | width: 100%;
159 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/mapper/UserMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 | INSERT INTO
8 | user(username, password, permission, email)
9 | VALUES(#{username}, #{password}, #{permission}, #{email})
10 |
11 |
12 |
22 |
23 |
32 |
33 |
34 | UPDATE user
35 | SET gender = #{gender}, name = #{name}, area = #{area}, address = #{address}, tel_phone = #{telPhone}, zip_code = #{zipCode}, email = #{email}
36 | WHERE id = #{id}
37 |
38 |
39 |
44 |
45 |
50 |
51 |
52 | UPDATE user
53 | SET token = #{token}
54 | WHERE id = #{id}
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/mapper/EquipmentMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 | INSERT INTO buy_equipment(name, count, price, request_buy_record_id, lab_id, origin)
8 | VALUES(#{name}, #{count}, #{price}, #{requestBuyRecordId}, #{labId}, #{origin})
9 |
10 |
11 |
31 |
32 |
48 |
49 |
50 | INSERT INTO equipment(name, origin, price, request_buy_record_id, lab_id, created_at, updated_at)
51 | VALUES(#{name}, #{origin}, #{price}, #{requestBuyRecordId}, #{labId}, NOW(), NOW())
52 |
53 |
54 |
55 | UPDATE equipment
56 | SET is_deleted = 1,
57 | delete_record_id = #{deleteRecordId}
58 | WHERE equipment.id in
59 |
61 | #{id}
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/WebRoot/WEB-INF/jsp/equipment/request_buy_equipment.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
3 | <%
4 | String path = request.getContextPath();
5 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
6 | %>
7 |
8 |
9 |
10 |
11 | 申请购买设备
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | - 主页
34 | - 申请购买设备
35 |
36 |
37 |
38 |
39 |
58 |
59 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |

81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/common/pojo/User.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.common.pojo;
2 |
3 | import java.io.Serializable;
4 | import java.util.Date;
5 |
6 | public class User implements Serializable{
7 | private static final long serialVersionUID = -2361117940525101094L;
8 |
9 | private int id;
10 | private String username;
11 | private String password;
12 | private String gender;
13 | private int permission;
14 | private String email;
15 | private String name;
16 | private String address;
17 | private String area;
18 | private String telPhone;
19 | private Role role;
20 | private String zipCode;
21 | private Date updatedAt;
22 | private Date createdAt;
23 | private String token;
24 |
25 | public int getId() {
26 | return id;
27 | }
28 |
29 | public void setId(int id) {
30 | this.id = id;
31 | }
32 |
33 | public String getUsername() {
34 | return username;
35 | }
36 |
37 | public void setUsername(String username) {
38 | this.username = username;
39 | }
40 |
41 | public String getPassword() {
42 | return password;
43 | }
44 |
45 | public void setPassword(String password) {
46 | this.password = password;
47 | }
48 |
49 | public String getGender() {
50 | return gender;
51 | }
52 |
53 | public void setGender(String gender) {
54 | this.gender = gender;
55 | }
56 |
57 | public int getPermission() {
58 | return permission;
59 | }
60 |
61 | public void setPermission(int permission) {
62 | this.permission = permission;
63 | }
64 |
65 | public String getEmail() {
66 | return email;
67 | }
68 |
69 | public void setEmail(String email) {
70 | this.email = email;
71 | }
72 |
73 | public String getName() {
74 | return name;
75 | }
76 |
77 | public void setName(String name) {
78 | this.name = name;
79 | }
80 |
81 | public String getAddress() {
82 | return address;
83 | }
84 |
85 | public void setAddress(String address) {
86 | this.address = address;
87 | }
88 |
89 | public String getArea() {
90 | return area;
91 | }
92 |
93 | public void setArea(String area) {
94 | this.area = area;
95 | }
96 |
97 | public String getTelPhone() {
98 | return telPhone;
99 | }
100 |
101 | public void setTelPhone(String telPhone) {
102 | this.telPhone = telPhone;
103 | }
104 |
105 | public Role getRole() {
106 | return role;
107 | }
108 |
109 | public void setRole(Role role) {
110 | this.role = role;
111 | }
112 |
113 | public User() {
114 | }
115 |
116 | public String getZipCode() {
117 | return zipCode;
118 | }
119 |
120 | public void setZipCode(String zipCode) {
121 | this.zipCode = zipCode;
122 | }
123 |
124 | public Date getUpdatedAt() {
125 | return updatedAt;
126 | }
127 |
128 | public Date getCreatedAt() {
129 | return createdAt;
130 | }
131 |
132 | public void setUpdatedAt(Date updatedAt) {
133 | this.updatedAt = updatedAt;
134 | }
135 |
136 | public void setCreatedAt(Date createdAt) {
137 | this.createdAt = createdAt;
138 | }
139 |
140 | public String getToken() {
141 | return token;
142 | }
143 |
144 | public void setToken(String token) {
145 | this.token = token;
146 | }
147 |
148 | @Override
149 | public String toString() {
150 | return "User [id=" + id + ", username=" + username + ", password=" + password + ", gender=" + gender + ", permission=" + permission + ", email=" + email + ", name=" + name
151 | + ", address=" + address + ", area=" + area + ", telPhone=" + telPhone + ", role=" + role + ", zipCode=" + zipCode + "]";
152 | }
153 | }
--------------------------------------------------------------------------------
/WebRoot/static/css/lab/main.css:
--------------------------------------------------------------------------------
1 | .userinfo form A:link, A:active {
2 | TEXT-DECORATION: none;
3 | Color: #000000
4 | }
5 |
6 | .userinfo form A:hover {
7 | TEXT-DECORATION: underline;
8 | Color: #858BAA
9 | }
10 |
11 | .userinfo form A:visited {
12 | TEXT-DECORATION: none;
13 | Color: #8A8A8A
14 | }
15 |
16 | BODY {
17 | FONT-SIZE: 12px;
18 | COLOR: #000000;
19 | FONT-FAMILY: 宋体;
20 | scrollbar-face-color: #DEE3E7;
21 | scrollbar-highlight-color: #FFFFFF;
22 | scrollbar-shadow-color: #DEE3E7;
23 | scrollbar-3dlight-color: #D1D7DC;
24 | scrollbar-arrow-color: #006699;
25 | scrollbar-track-color: #EFEFEF;
26 | scrollbar-darkshadow-color: #98AAB1;
27 | }
28 |
29 | font {
30 | line-height: normal;
31 | }
32 |
33 | .userinfo form TD {
34 | font-family: 宋体;
35 | font-size: 12px;
36 | line-height: 15px;
37 | }
38 |
39 | .userinfo form th {
40 | background-image: url('images/bg2.gif');
41 | background-color: #858BAA;
42 | color: white;
43 | font-size: 12px;
44 | font-weight: bold
45 | }
46 |
47 | .userinfo form td.TableTitle2 {
48 | background-color: #E4F3FF;
49 | }
50 |
51 | .userinfo form td.TableBody1 {
52 | background-color: #FFFFFF;
53 | line-height: normal;
54 | }
55 |
56 | .userinfo form td.TableBody2 {
57 | background-color: #E4F3FF;
58 | line-height: normal;
59 | }
60 |
61 | .userinfo form td.TopDarkNav {
62 | background-image: url(skins/default/css/default/topbg.gif);
63 | }
64 |
65 | .userinfo form td.TopLighNav {
66 | background-image: url('images/bottombg.gif');
67 | }
68 |
69 | .userinfo form td.TopLighNav1 {
70 | background-image: url('images/tabs_m_tile.gif');
71 | }
72 |
73 | .userinfo form td.TopLighNav2 {
74 | background-color: #FFFFFF
75 | }
76 |
77 | .tableBorder1 {
78 | width: 97%;
79 | border: 1px;
80 | background-color: #AFB2C4;
81 | }
82 |
83 | .tableBorder2 {
84 | width: 97%;
85 | border: 1px #DEDEDE solid;
86 | background-color: #EFEFEF;
87 | }
88 |
89 | #TableTitleLink A:link, #TableTitleLink A:visited, #TableTitleLink A:active
90 | {
91 | COLOR: #FFFFFF;
92 | TEXT-DECORATION: none;
93 | }
94 |
95 | #TableTitleLink A:hover {
96 | COLOR: #FFFFFF;
97 | TEXT-DECORATION: underline;
98 | }
99 |
100 | input, select, Textarea, option {
101 | font-family: Tahoma, Verdana, "宋体";
102 | font-size: 12px;
103 | line-height: 15px;
104 | COLOR: #000000;
105 | }
106 |
107 | .normalTextSmall {
108 | font-size: 11px;
109 | color: #000000;
110 | font-family: Verdana, Arial, Helvetica, sans-serif;
111 | }
112 |
113 | .menuskin {
114 | BORDER: 1px solid #666666;
115 | VISIBILITY: hidden;
116 | POSITION: absolute;
117 | BACKGROUND-COLOR: #EFEFEF;
118 | background-image: url('images/dvmenubg3.gif');
119 | background-repeat: repeat-y;
120 | font-style: normal;
121 | font-variant: normal;
122 | font-weight: normal;
123 | font-size: 12px;
124 | font-family: Verdana
125 | }
126 |
127 | .menuskin A {
128 | PADDING-RIGHT: 10px;
129 | PADDING-LEFT: 25px;
130 | COLOR: black;
131 | TEXT-DECORATION: none;
132 | behavior: url(inc/noline.htc);
133 | }
134 |
135 | #mouseoverstyle {
136 | BACKGROUND-COLOR: #C9D5E7;
137 | margin: 2px;
138 | padding: 0px;
139 | border: #597DB5 1px solid;
140 | }
141 |
142 | #mouseoverstyle A {
143 | COLOR: black
144 | }
145 |
146 | .menuitems {
147 | margin: 2px;
148 | padding: 1px;
149 | word-break: keep-all;
150 | }
151 |
152 | .userinfo form a.navlink:link {
153 | color: #000000;
154 | text-decoration: none
155 | }
156 |
157 | .userinfo form a.navlink:visited {
158 | color: #000000;
159 | text-decoration: none
160 | }
161 |
162 | .userinfo form a.navlink:hover {
163 | color: #003399;
164 | text-decoration: none
165 | }
166 |
167 | .BrightClass {
168 | background-color: #D7D7D7;
169 | }
170 | /*
171 | 编辑器特效CSS样式
172 | */
173 | div.quote {
174 | margin: 5px 20px;
175 | border: 1px solid #CCCCCC;
176 | padding: 5px;
177 | background: #F3F3F3;
178 | line-height: normal;
179 | }
180 |
181 | div.HtmlCode {
182 | margin: 5px 20px;
183 | border: 1px solid #CCCCCC;
184 | padding: 5px;
185 | background: #FDFDDF;
186 | font-size: 14px;
187 | font-family: Tahoma;
188 | font-style: oblique;
189 | line-height: normal;
190 | font-weight: bold;
191 | }
--------------------------------------------------------------------------------
/src/top/yjzloveyzh/controller/EquipmentController.java:
--------------------------------------------------------------------------------
1 | package top.yjzloveyzh.controller;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 | import java.util.HashMap;
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpServletResponse;
11 | import javax.servlet.http.HttpSession;
12 |
13 | import org.springframework.beans.factory.annotation.Autowired;
14 | import org.springframework.beans.factory.annotation.Qualifier;
15 | import org.springframework.stereotype.Controller;
16 | import org.springframework.web.bind.annotation.RequestBody;
17 | import org.springframework.web.bind.annotation.RequestMapping;
18 | import org.springframework.web.bind.annotation.RequestMethod;
19 | import org.springframework.web.bind.annotation.ResponseBody;
20 | import org.springframework.web.servlet.mvc.support.RedirectAttributes;
21 |
22 | import com.fasterxml.jackson.core.JsonProcessingException;
23 | import com.fasterxml.jackson.databind.ObjectMapper;
24 |
25 | import top.yjzloveyzh.common.Constants;
26 | import top.yjzloveyzh.common.exception.EquipmentException;
27 | import top.yjzloveyzh.common.pojo.Equipment;
28 | import top.yjzloveyzh.common.pojo.Lab;
29 | import top.yjzloveyzh.common.pojo.Pagination;
30 | import top.yjzloveyzh.common.pojo.User;
31 | import top.yjzloveyzh.services.EquipmentService;
32 | import top.yjzloveyzh.services.LabService;
33 |
34 | @Controller
35 | @RequestMapping("/equipment")
36 | public class EquipmentController {
37 |
38 | @Qualifier(value="equipmentServiceImpl")
39 | @Autowired
40 | EquipmentService equipmentService;
41 |
42 | @Qualifier(value="labServiceImpl")
43 | @Autowired
44 | LabService labService;
45 |
46 | @RequestMapping("/toRequestBuyEquip")
47 | public String toRequestBuyEquip(HttpServletRequest request) throws JsonProcessingException {
48 |
49 | List labs = labService.getLabs();
50 | ObjectMapper objectMapper = new ObjectMapper();
51 | String labsJson = objectMapper.writeValueAsString(labs);
52 |
53 | request.setAttribute(Constants.EquipmentController.KEY_LABS, labsJson);
54 |
55 | return "equipment/request_buy_equipment";
56 | }
57 |
58 | @RequestMapping(value = "/request-buy", method = RequestMethod.POST, consumes = "application/json")
59 | public @ResponseBody Map requestBuy(@RequestBody Map equipments, HttpServletResponse response, HttpSession session) throws IOException {
60 |
61 | ArrayList