userIds) {
+ this.userIds = userIds;
+ StringBuffer buff = new StringBuffer();
+ for(String id : userIds) {
+ buff.append(id).append(',');
+ }
+ this.userIdsStr = buff.toString();
+ }
+
+ public String getUserIdsStr() {
+ return userIdsStr;
+ }
+
+ public void setUserIdsStr(String userIdsStr) {
+ this.userIdsStr = userIdsStr;
+ this.userIds = Lists.newArrayList();
+ if(!StringUtils.isEmpty(userIdsStr)) {
+ String[] ids = userIdsStr.split(",");
+ for(String id : ids) {
+ this.userIds.add(id);
+ }
+ }
+ }
+
+ public String getArea() {
+ return area;
+ }
+
+ public void setArea(String area) {
+ this.area = area;
+ }
+
+ public String getUsernames() {
+ return usernames;
+ }
+
+ public void setUsernames(String usernames) {
+ this.usernames = usernames;
+ }
+
+ @Override
+ public String toString() {
+ return "Agent [id=" + id + ", level=" + level + ", agentName="
+ + agentName + ", userIds=" + userIds + ", area=" + area + "]";
+ }
+}
diff --git a/src/main/java/com/entity/Area.java b/src/main/java/com/entity/Area.java
new file mode 100644
index 0000000..6d46248
--- /dev/null
+++ b/src/main/java/com/entity/Area.java
@@ -0,0 +1,25 @@
+package com.entity;
+
+import java.io.Serializable;
+
+public class Area implements Serializable {
+ private static final long serialVersionUID = 8852738152430122859L;
+ private Long id;
+ private String area;
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public String getArea() {
+ return area;
+ }
+ public void setArea(String area) {
+ this.area = area;
+ }
+ @Override
+ public String toString() {
+ return "Area [id=" + id + ", area=" + area + "]";
+ }
+}
diff --git a/src/main/java/com/entity/Car.java b/src/main/java/com/entity/Car.java
new file mode 100644
index 0000000..e85a764
--- /dev/null
+++ b/src/main/java/com/entity/Car.java
@@ -0,0 +1,84 @@
+package com.entity;
+
+import java.io.Serializable;
+
+import org.hibernate.validator.constraints.NotEmpty;
+
+public class Car implements Serializable{
+ private static final long serialVersionUID = 6534271072663770032L;
+ private Long id;
+ @NotEmpty
+ private Boolean isSale;
+ @NotEmpty
+ private String carId;
+ @NotEmpty
+ private Integer high;
+ @NotEmpty
+ private Integer length;
+ @NotEmpty
+ private Integer wide;
+ @NotEmpty
+ private Integer weight;
+
+ public Car() {
+ super();
+ }
+ public Car(String carId,Boolean isSale, Integer high,
+ Integer length, Integer wide, Integer weight) {
+ super();
+ this.isSale = isSale;
+ this.carId = carId;
+ this.high = high;
+ this.length = length;
+ this.wide = wide;
+ this.weight = weight;
+ }
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public Boolean getIsSale() {
+ return isSale;
+ }
+ public void setIsSale(Boolean isSale) {
+ this.isSale = isSale;
+ }
+ public String getCarId() {
+ return carId;
+ }
+ public void setCarId(String carId) {
+ this.carId = carId;
+ }
+ public Integer getHigh() {
+ return high;
+ }
+ public void setHigh(Integer high) {
+ this.high = high;
+ }
+ public Integer getLength() {
+ return length;
+ }
+ public void setLength(Integer length) {
+ this.length = length;
+ }
+ public Integer getWide() {
+ return wide;
+ }
+ public void setWide(Integer wide) {
+ this.wide = wide;
+ }
+ public Integer getWeight() {
+ return weight;
+ }
+ public void setWeight(Integer weight) {
+ this.weight = weight;
+ }
+ @Override
+ public String toString() {
+ return "Car [id=" + id + ", isSale=" + isSale + ", carId=" + carId
+ + ", high=" + high + ", length=" + length + ", wide=" + wide
+ + ", weight=" + weight + "]";
+ }
+}
diff --git a/src/main/java/com/entity/FileInfo.java b/src/main/java/com/entity/FileInfo.java
new file mode 100644
index 0000000..ccc03fe
--- /dev/null
+++ b/src/main/java/com/entity/FileInfo.java
@@ -0,0 +1,78 @@
+package com.entity;
+
+import java.io.Serializable;
+
+public class FileInfo implements Serializable {
+ private static final long serialVersionUID = 3517465238526255583L;
+ private Long id;
+ private String fileName;
+ private String filePath;
+ private String fileType;
+ private String originalFilename;
+ private String uuid;
+ private String uploadTime;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public String getFilePath() {
+ return filePath;
+ }
+
+ public void setFilePath(String filePath) {
+ this.filePath = filePath;
+ }
+
+ public String getUploadTime() {
+ return uploadTime;
+ }
+
+ public void setUploadTime(String uploadTime) {
+ this.uploadTime = uploadTime;
+ }
+
+ public String getFileType() {
+ return fileType;
+ }
+
+ public void setFileType(String fileType) {
+ this.fileType = fileType;
+ }
+
+ public String getOriginalFilename() {
+ return originalFilename;
+ }
+
+ public void setOriginalFilename(String originalFilename) {
+ this.originalFilename = originalFilename;
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ @Override
+ public String toString() {
+ return "FileInfo [id=" + id + ", fileName=" + fileName + ", filePath="
+ + filePath + ", uploadTime=" + uploadTime + ", fileType="
+ + fileType + ", originalFilename=" + originalFilename
+ + ", uuid=" + uuid + "]";
+ }
+}
diff --git a/src/main/java/com/entity/Order.java b/src/main/java/com/entity/Order.java
new file mode 100644
index 0000000..7d2c4de
--- /dev/null
+++ b/src/main/java/com/entity/Order.java
@@ -0,0 +1,81 @@
+package com.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.entity.enumeration.OrderType;
+import com.entity.enumeration.Status;
+
+public class Order implements Serializable{
+ private static final long serialVersionUID = -2545303099330416597L;
+ private Long id;
+ private String openid;
+ private String carId;
+ private Integer carCnt;
+ private Double price;
+ private Status status;
+ private OrderType orderType;
+ private Date startTime;
+ private Date deliverTime;
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public String getOpenid() {
+ return openid;
+ }
+ public void setOpenid(String openid) {
+ this.openid = openid;
+ }
+ public String getCarId() {
+ return carId;
+ }
+ public void setCarId(String carId) {
+ this.carId = carId;
+ }
+ public Integer getCarCnt() {
+ return carCnt;
+ }
+ public void setCarCnt(Integer carCnt) {
+ this.carCnt = carCnt;
+ }
+ public Double getPrice() {
+ return price;
+ }
+ public void setPrice(Double price) {
+ this.price = price;
+ }
+ public Status getStatus() {
+ return status;
+ }
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+ public OrderType getOrderType() {
+ return orderType;
+ }
+ public void setOrderType(OrderType orderType) {
+ this.orderType = orderType;
+ }
+ public Date getStartTime() {
+ return startTime;
+ }
+ public void setStartTime(Date startTime) {
+ this.startTime = startTime;
+ }
+ public Date getDeliverTime() {
+ return deliverTime;
+ }
+ public void setDeliverTime(Date deliverTime) {
+ this.deliverTime = deliverTime;
+ }
+ @Override
+ public String toString() {
+ return "Order [id=" + id + ", openid=" + openid + ", carId=" + carId
+ + ", carCnt=" + carCnt + ", price=" + price + ", status="
+ + status + ", orderType=" + orderType + ", startTime="
+ + startTime + ", deliverTime=" + deliverTime + "]";
+ }
+}
diff --git a/src/main/java/com/entity/Procurement.java b/src/main/java/com/entity/Procurement.java
new file mode 100644
index 0000000..20e46f6
--- /dev/null
+++ b/src/main/java/com/entity/Procurement.java
@@ -0,0 +1,130 @@
+package com.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.hibernate.validator.constraints.NotEmpty;
+
+public class Procurement implements Serializable{
+ private static final long serialVersionUID = 6534271072663770032L;
+ private Long id;
+ @NotEmpty
+ private String procureId;
+ @NotEmpty
+ private Integer inventory;
+ @NotEmpty
+ private Integer startInventory;
+ @NotEmpty
+ private Integer endInventory;
+ @NotEmpty
+ private Integer price;
+ @NotEmpty
+ private Integer startPrice;
+ @NotEmpty
+ private Integer endPrice;
+ @NotEmpty
+ private String procureTime;
+ @NotEmpty
+ private Date startTime;
+ @NotEmpty
+ private Date endTime;
+
+ private String procureFilePath;
+ private String procureFileName;
+
+ public String getProcureFilePath() {
+ return procureFilePath;
+ }
+ public void setProcureFilePath(String procureFilePath) {
+ this.procureFilePath = procureFilePath;
+ }
+ public String getProcureFileName() {
+ return procureFileName;
+ }
+ public void setProcureFileName(String procureFileName) {
+ this.procureFileName = procureFileName;
+ }
+ public Procurement() {
+ super();
+ }
+ public Procurement(String carId,Boolean isSale, Integer high,
+ Integer length, Integer wide, Integer weight) {
+ super();
+ this.procureId = procureId;
+ this.inventory = inventory;
+ this.price = price;
+ this.procureTime = procureTime;
+ }
+ public Integer getStartInventory() {
+ return startInventory;
+ }
+ public void setStartInventory(Integer startInventory) {
+ this.startInventory = startInventory;
+ }
+ public Integer getEndInventory() {
+ return endInventory;
+ }
+ public void setEndInventory(Integer endInventory) {
+ this.endInventory = endInventory;
+ }
+ public Integer getStartPrice() {
+ return startPrice;
+ }
+ public void setStartPrice(Integer startPrice) {
+ this.startPrice = startPrice;
+ }
+ public Integer getEndPrice() {
+ return endPrice;
+ }
+ public void setEndPrice(Integer endPrice) {
+ this.endPrice = endPrice;
+ }
+
+ public Date getStartTime() {
+ return startTime;
+ }
+ public void setStartTime(Date startTime) {
+ this.startTime = startTime;
+ }
+ public Date getEndTime() {
+ return endTime;
+ }
+ public void setEndTime(Date endTime) {
+ this.endTime = endTime;
+ }
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public String getProcureId() {
+ return procureId;
+ }
+ public void setProcureId(String procureId) {
+ this.procureId = procureId;
+ }
+ public Integer getInventory() {
+ return inventory;
+ }
+ public void setInventory(Integer inventory) {
+ this.inventory = inventory;
+ }
+ public Integer getPrice() {
+ return price;
+ }
+ public void setPrice(Integer price) {
+ this.price = price;
+ }
+ public String getProcureTime() {
+ return procureTime;
+ }
+ public void setProcureTime(String procureTime) {
+ this.procureTime = procureTime;
+ }
+ @Override
+ public String toString() {
+ return "Procurement [id=" + id + ", procureId=" + procureId + ", inventory=" + inventory
+ + ", price=" + price + ", procureTime=" + procureTime + "]";
+ }
+}
diff --git a/src/main/java/com/giit/www/entity/Resource.java b/src/main/java/com/entity/Resource.java
similarity index 52%
rename from src/main/java/com/giit/www/entity/Resource.java
rename to src/main/java/com/entity/Resource.java
index 2bea0d6..4176688 100644
--- a/src/main/java/com/giit/www/entity/Resource.java
+++ b/src/main/java/com/entity/Resource.java
@@ -1,135 +1,83 @@
-package com.giit.www.entity;
-
-import java.io.Serializable;
-
-/**
- * User: Zhang Kaitao
- *
Date: 14-1-28
- *
Version: 1.0
- */
-public class Resource implements Serializable {
- private Long id; //编号
- private String name; //资源名称
- private ResourceType type = ResourceType.menu; //资源类型
- private String url; //资源路径
- private String permission; //权限字符串
- private Long parentId; //父编号
- private String parentIds; //父编号列表
- private Boolean available = Boolean.FALSE;
-
- public static enum ResourceType {
- menu("菜单"), button("按钮");
-
- private final String info;
- private ResourceType(String info) {
- this.info = info;
- }
-
- public String getInfo() {
- return info;
- }
- }
-
-
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public ResourceType getType() {
- return type;
- }
-
- public void setType(ResourceType type) {
- this.type = type;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getPermission() {
- return permission;
- }
-
- public void setPermission(String permission) {
- this.permission = permission;
- }
-
- public Long getParentId() {
- return parentId;
- }
-
- public void setParentId(Long parentId) {
- this.parentId = parentId;
- }
-
- public String getParentIds() {
- return parentIds;
- }
-
- public void setParentIds(String parentIds) {
- this.parentIds = parentIds;
- }
-
- public Boolean getAvailable() {
- return available;
- }
-
- public void setAvailable(Boolean available) {
- this.available = available;
- }
-
- public boolean isRootNode() {
- return parentId == 0;
- }
-
- public String makeSelfAsParentIds() {
- return getParentIds() + getId() + "/";
- }
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Resource resource = (Resource) o;
-
- if (id != null ? !id.equals(resource.id) : resource.id != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return id != null ? id.hashCode() : 0;
- }
-
- @Override
- public String toString() {
- return "Resource{" +
- "id=" + id +
- ", name='" + name + '\'' +
- ", type=" + type +
- ", permission='" + permission + '\'' +
- ", parentId=" + parentId +
- ", parentIds='" + parentIds + '\'' +
- ", available=" + available +
- '}';
- }
-}
+package com.entity;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ *
User: Zhang Kaitao
+ *
Date: 14-1-28
+ *
Version: 1.0
+ */
+public class Resource implements Serializable {
+ private Long id; //编号
+ private String name; //资源名称
+ private String permission; //权限字符串
+ private Boolean available = Boolean.FALSE;
+ private List resourceTypes;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPermission() {
+ return permission;
+ }
+
+ public void setPermission(String permission) {
+ this.permission = permission;
+ }
+
+ public Boolean getAvailable() {
+ return available;
+ }
+
+ public void setAvailable(Boolean available) {
+ this.available = available;
+ }
+ public List getResourceTypes() {
+ return resourceTypes;
+ }
+
+ public void setResourceTypes(List resourceTypes) {
+ this.resourceTypes = resourceTypes;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Resource resource = (Resource) o;
+
+ if (id != null ? !id.equals(resource.id) : resource.id != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return id != null ? id.hashCode() : 0;
+ }
+
+ @Override
+ public String toString() {
+ return "Resource{" +
+ "id=" + id +
+ ", name='" + name + '\'' +
+ ", permission='" + permission + '\'' +
+ ", available=" + available +
+ '}';
+ }
+}
diff --git a/src/main/java/com/entity/ResourceType.java b/src/main/java/com/entity/ResourceType.java
new file mode 100644
index 0000000..3ae02ad
--- /dev/null
+++ b/src/main/java/com/entity/ResourceType.java
@@ -0,0 +1,5 @@
+package com.entity;
+
+public enum ResourceType{
+ QUERY,ADD,UPDATE,DELETE;
+}
diff --git a/src/main/java/com/giit/www/entity/Role.java b/src/main/java/com/entity/Role.java
similarity index 88%
rename from src/main/java/com/giit/www/entity/Role.java
rename to src/main/java/com/entity/Role.java
index 95be6c1..77d0a76 100644
--- a/src/main/java/com/giit/www/entity/Role.java
+++ b/src/main/java/com/entity/Role.java
@@ -1,136 +1,147 @@
-package com.giit.www.entity;
-
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * User: Zhang Kaitao
- *
Date: 14-1-28
- *
Version: 1.0
- */
-public class Role implements Serializable {
- private Long id; //编号
- private String role; //角色标识 程序中判断使用,如"admin"
- private String description; //角色描述,UI界面显示使用
- private List resourceIds; //拥有的资源
- private String resourceIdsStr; //拥有的资源
- private Boolean available = Boolean.FALSE; //是否可用,如果不可用将不会添加给用户
-
- public Role() {
- }
-
- public Role(String role, String description, Boolean available) {
- this.role = role;
- this.description = description;
- this.available = available;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getRole() {
- return role;
- }
-
- public void setRole(String role) {
- this.role = role;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public List getResourceIds() {
- if (resourceIds == null) {
- resourceIds = new ArrayList();
- }
- return resourceIds;
- }
-
- public void setResourceIds(List resourceIds) {
- this.resourceIds = resourceIds;
- this.resourceIdsStr = parseScrToStr();
- }
-
- public String parseScrToStr() {
- if (CollectionUtils.isEmpty(resourceIds)) {
- return "";
- }
- StringBuilder s = new StringBuilder();
- for (Long resourceId : resourceIds) {
- s.append(resourceId);
- s.append(",");
- }
- return s.toString();
- }
-
- public String getResourceIdsStr() {
- return resourceIdsStr;
- }
-
- public void setResourceIdsStr(String resourceIdsStr) {
- this.resourceIdsStr = resourceIdsStr;
- }
-
- public void parseScrToLongList(String resourceIdsStr) {
- if (StringUtils.isEmpty(resourceIdsStr)) {
- return;
- }
- String[] resourceIdStrs = resourceIdsStr.split(",");
- for (String resourceIdStr : resourceIdStrs) {
- if (StringUtils.isEmpty(resourceIdStr)) {
- continue;
- }
- getResourceIds().add(Long.valueOf(resourceIdStr));
- }
- }
-
- public Boolean getAvailable() {
- return available;
- }
-
- public void setAvailable(Boolean available) {
- this.available = available;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Role role = (Role) o;
-
- if (id != null ? !id.equals(role.id) : role.id != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return id != null ? id.hashCode() : 0;
- }
-
- @Override
- public String toString() {
- return "Role{" +
- "id=" + id +
- ", role='" + role + '\'' +
- ", description='" + description + '\'' +
- ", resourceIds=" + resourceIds +
- ", available=" + available +
- '}';
- }
-}
+package com.entity;
+
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * User: Zhang Kaitao
+ *
Date: 14-1-28
+ *
Version: 1.0
+ */
+public class Role implements Serializable {
+ private Long id; //编号
+ private String role; //角色标识 程序中判断使用,如"admin"
+ private String description; //角色描述,UI界面显示使用
+ private List resourceIds; //拥有的资源
+ private String resourceIdsStr; //拥有的资源
+ private String resourceNames; //拥有资源名称
+ private Boolean available = Boolean.FALSE; //是否可用,如果不可用将不会添加给用户
+
+ public Role() {
+ }
+
+ public Role(String role, String description, Boolean available) {
+ this.role = role;
+ this.description = description;
+ this.available = available;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public List getResourceIds() {
+ if (resourceIds == null) {
+ resourceIds = new ArrayList();
+ }
+ return resourceIds;
+ }
+
+ public void setResourceIds(List resourceIds) {
+ this.resourceIds = resourceIds;
+ this.resourceIdsStr = parseScrToStr();
+ }
+
+ public String parseScrToStr() {
+ if (CollectionUtils.isEmpty(resourceIds)) {
+ return "";
+ }
+ StringBuilder s = new StringBuilder();
+ for (Long resourceId : resourceIds) {
+ s.append(resourceId);
+ s.append(",");
+ }
+ return s.toString();
+ }
+
+ public String getResourceIdsStr() {
+ return resourceIdsStr;
+ }
+
+ public void setResourceIdsStr(String resourceIdsStr) {
+ this.resourceIdsStr = resourceIdsStr;
+ parseScrToLongList(resourceIdsStr);
+
+ }
+
+ public void parseScrToLongList(String resourceIdsStr) {
+ if (StringUtils.isEmpty(resourceIdsStr)) {
+ return;
+ }
+ String[] resourceIdStrs = resourceIdsStr.split(",");
+ for (String resourceIdStr : resourceIdStrs) {
+ if (StringUtils.isEmpty(resourceIdStr)) {
+ continue;
+ }
+ getResourceIds().add(Long.valueOf(resourceIdStr));
+ }
+ }
+
+ public Boolean getAvailable() {
+ return available;
+ }
+
+ public void setAvailable(Boolean available) {
+ this.available = available;
+ }
+
+ public String getResourceNames() {
+ return resourceNames;
+ }
+
+ public void setResourceNames(String resourceNames) {
+ this.resourceNames = resourceNames;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Role role = (Role) o;
+
+ if (id != null ? !id.equals(role.id) : role.id != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return id != null ? id.hashCode() : 0;
+ }
+
+ @Override
+ public String toString() {
+ return "Role{" +
+ "id=" + id +
+ ", role='" + role + '\'' +
+ ", description='" + description + '\'' +
+ ", resourceIds=" + resourceIds +
+ ", available=" + available +
+ '}';
+ }
+}
diff --git a/src/main/java/com/entity/Standard.java b/src/main/java/com/entity/Standard.java
new file mode 100644
index 0000000..b64cdde
--- /dev/null
+++ b/src/main/java/com/entity/Standard.java
@@ -0,0 +1,25 @@
+package com.entity;
+
+import java.io.Serializable;
+
+public class Standard implements Serializable {
+ private static final long serialVersionUID = 8777006716841782687L;
+ private Long id;
+ private String carId;
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public String getCarId() {
+ return carId;
+ }
+ public void setCarId(String carId) {
+ this.carId = carId;
+ }
+ @Override
+ public String toString() {
+ return "Standard [id=" + id + ", carId=" + carId + "]";
+ }
+}
diff --git a/src/main/java/com/giit/www/entity/User.java b/src/main/java/com/entity/User.java
similarity index 59%
rename from src/main/java/com/giit/www/entity/User.java
rename to src/main/java/com/entity/User.java
index c064529..4092a5b 100644
--- a/src/main/java/com/giit/www/entity/User.java
+++ b/src/main/java/com/entity/User.java
@@ -1,103 +1,128 @@
-package com.giit.www.entity;
-
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public class User {
- String username; //用户名
- String userId;
- String password;
- String salt;
- private List roleIds; //拥有的角色列表
- private Boolean locked = Boolean.FALSE;
-
-
- public String getUserId() {
- return userId;
- }
-
- public void setUserId(String userId) {
- this.userId = userId;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getSalt() {
- return salt;
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
- public List getRoleIds() {
- return roleIds;
- }
-
- public void setRoleIds(List roleIds) {
- this.roleIds = roleIds;
- }
-
- public Boolean getLocked() {
- return locked;
- }
-
- public void setLocked(Boolean locked) {
- this.locked = locked;
- }
-
- public void setSalt(String salt) {
- this.salt = salt;
- }
-
-
- public String getCredentialsSalt() {
- return username + salt;
- }
-
- public String getRoleIdsStr() {
- if (CollectionUtils.isEmpty(roleIds)) {
- return "";
- }
- StringBuilder s = new StringBuilder();
- int i = 0;
- for (; i < roleIds.size() - 1; i++) {
- Long roleId = roleIds.get(i);
- s.append(roleId);
- s.append(",");
- }
- s.append(roleIds.get(i));
-
- return s.toString();
- }
-
- public void setRoleIdsStr(String roleIdsStr) {
- if (StringUtils.isEmpty(roleIdsStr)) {
- return;
- }
- roleIds = new ArrayList<>();
- String[] roleIdStrs = roleIdsStr.split(",");
- for (String roleIdStr : roleIdStrs) {
- if (StringUtils.isEmpty(roleIdStr)) {
- continue;
- }
- roleIds.add(Long.valueOf(roleIdStr));
- }
- }
-}
+package com.entity;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.hibernate.validator.constraints.NotBlank;
+import org.springframework.util.StringUtils;
+
+public class User {
+ String username; //用户名
+ @NotBlank
+ String userId;
+ String password;
+ String[] passwords;
+ String salt;
+ private List roleIds; //拥有的角色列表
+ private String roleIdsStr;
+ private String roleDesc;
+ private Boolean locked = Boolean.FALSE;
+
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getSalt() {
+ return salt;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public List getRoleIds() {
+ return roleIds;
+ }
+
+ public String getRoleDesc() {
+ return roleDesc;
+ }
+
+ public void setRoleDesc(String roleDesc) {
+ this.roleDesc = roleDesc;
+ }
+
+ public void setRoleIds(List roleIds) {
+ this.roleIds = roleIds;
+ StringBuilder s = new StringBuilder();
+ int i = 0;
+ for (; i < roleIds.size() - 1; i++) {
+ Long roleId = roleIds.get(i);
+ s.append(roleId);
+ s.append(",");
+ }
+ s.append(roleIds.get(i));
+
+ this.roleIdsStr = s.toString();
+ }
+
+ public Boolean getLocked() {
+ return locked;
+ }
+
+ public void setLocked(Boolean locked) {
+ this.locked = locked;
+ }
+
+ public void setSalt(String salt) {
+ this.salt = salt;
+ }
+
+ public String getCredentialsSalt() {
+ return userId + salt;
+ }
+
+ public String[] getPasswords() {
+ return passwords;
+ }
+
+ public void setPasswords(String[] passwords) {
+ this.passwords = passwords;
+ }
+
+ public String getRoleIdsStr() {
+ return roleIdsStr;
+ }
+
+ public void setRoleIdsStr(String roleIdsStr) {
+ this.roleIdsStr = roleIdsStr;
+ if (StringUtils.isEmpty(roleIdsStr)) {
+ return;
+ }
+ roleIds = new ArrayList<>();
+ String[] roleIdStrs = roleIdsStr.split(",");
+ for (String roleIdStr : roleIdStrs) {
+ if (StringUtils.isEmpty(roleIdStr)) {
+ continue;
+ }
+ roleIds.add(Long.valueOf(roleIdStr));
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "User [username=" + username + ", userId=" + userId
+ + ", password=" + password + ", passwords="
+ + Arrays.toString(passwords) + ", salt=" + salt + ", roleIds="
+ + roleIds + ", roleIdsStr=" + roleIdsStr + ", roleDesc="
+ + roleDesc + ", locked=" + locked + "]";
+ }
+}
diff --git a/src/main/java/com/entity/Vendor.java b/src/main/java/com/entity/Vendor.java
new file mode 100644
index 0000000..521cc54
--- /dev/null
+++ b/src/main/java/com/entity/Vendor.java
@@ -0,0 +1,77 @@
+package com.entity;
+
+import java.io.Serializable;
+
+public class Vendor implements Serializable {
+ private static final long serialVersionUID = -4471300730875048038L;
+ private Long id;
+ private String vendorName;
+ private String contact;
+ private String url;
+ private String address;
+ private String telephone;
+ private String phone;
+ private String email;
+ private Long attachId;
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public String getVendorName() {
+ return vendorName;
+ }
+ public void setVendorName(String vendorName) {
+ this.vendorName = vendorName;
+ }
+ public String getContact() {
+ return contact;
+ }
+ public void setContact(String contact) {
+ this.contact = contact;
+ }
+ public String getUrl() {
+ return url;
+ }
+ public void setUrl(String url) {
+ this.url = url;
+ }
+ public String getAddress() {
+ return address;
+ }
+ public void setAddress(String address) {
+ this.address = address;
+ }
+ public String getTelephone() {
+ return telephone;
+ }
+ public void setTelephone(String telephone) {
+ this.telephone = telephone;
+ }
+ public String getPhone() {
+ return phone;
+ }
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+ public Long getAttachId() {
+ return attachId;
+ }
+ public void setAttachId(Long attachId) {
+ this.attachId = attachId;
+ }
+ public String getEmail() {
+ return email;
+ }
+ public void setEmail(String email) {
+ this.email = email;
+ }
+ @Override
+ public String toString() {
+ return "Vendor [id=" + id + ", vendorName=" + vendorName + ", contact="
+ + contact + ", url=" + url + ", address=" + address
+ + ", telephone=" + telephone + ", phone=" + phone + ", email="
+ + email + ", attachId=" + attachId + "]";
+ }
+}
diff --git a/src/main/java/com/entity/enumeration/AgentLevel.java b/src/main/java/com/entity/enumeration/AgentLevel.java
new file mode 100644
index 0000000..2de0a37
--- /dev/null
+++ b/src/main/java/com/entity/enumeration/AgentLevel.java
@@ -0,0 +1,42 @@
+package com.entity.enumeration;
+
+import org.springframework.util.StringUtils;
+
+public enum AgentLevel {
+ VIP("VIP",0,Integer.MAX_VALUE),NORMAL("普通",0,2000),NOCARE("不关注",2000,5000);
+ private String name;
+ private Integer minPrice;
+ private Integer maxPrice;
+ AgentLevel(String name,Integer minPrice,Integer maxPrice) {
+ this.name = name;
+ this.minPrice=minPrice;
+ this.maxPrice=maxPrice;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Integer getMinPrice() {
+ return minPrice;
+ }
+ public void setMinPrice(Integer minPrice) {
+ this.minPrice = minPrice;
+ }
+ public Integer getMaxPrice() {
+ return maxPrice;
+ }
+ public void setMaxPrice(Integer maxPrice) {
+ this.maxPrice = maxPrice;
+ }
+ public static AgentLevel parse(String text) {
+ if(!StringUtils.isEmpty(text)) {
+ for(AgentLevel entry : AgentLevel.values()) {
+ if(entry.getName().equals(text))
+ return entry;
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/entity/enumeration/OrderType.java b/src/main/java/com/entity/enumeration/OrderType.java
new file mode 100644
index 0000000..571d74f
--- /dev/null
+++ b/src/main/java/com/entity/enumeration/OrderType.java
@@ -0,0 +1,29 @@
+package com.entity.enumeration;
+
+import org.springframework.util.StringUtils;
+
+
+public enum OrderType {
+ DISTRIBUTION("分销订单"),DISTRIBUTION_REJECTED("分销退货订单"),DISTRIBUTION_EXCHANGE("分销换货订单");
+
+ private String name;
+ OrderType(String name) {
+ this.name = name;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public static AgentLevel parse(String text) {
+ if(!StringUtils.isEmpty(text)) {
+ for(AgentLevel entry : AgentLevel.values()) {
+ if(entry.getName().equals(text))
+ return entry;
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/entity/enumeration/Status.java b/src/main/java/com/entity/enumeration/Status.java
new file mode 100644
index 0000000..54dfc6d
--- /dev/null
+++ b/src/main/java/com/entity/enumeration/Status.java
@@ -0,0 +1,6 @@
+package com.entity.enumeration;
+
+
+public enum Status {
+ START,END,UNAUDIT,AUDIT,NON_PAYMENT,PAYMENT,NOT_DISTRIBUTION,DISTRIBUTION;
+}
\ No newline at end of file
diff --git a/src/main/java/com/giit/www/exception/DefaultExceptionHandler.java b/src/main/java/com/exception/DefaultExceptionHandler.java
similarity index 61%
rename from src/main/java/com/giit/www/exception/DefaultExceptionHandler.java
rename to src/main/java/com/exception/DefaultExceptionHandler.java
index 6fa4de7..f8e6d34 100644
--- a/src/main/java/com/giit/www/exception/DefaultExceptionHandler.java
+++ b/src/main/java/com/exception/DefaultExceptionHandler.java
@@ -1,33 +1,30 @@
-package com.giit.www.exception;
-
-import org.apache.shiro.authz.AuthorizationException;
-import org.apache.shiro.authz.UnauthorizedException;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.ControllerAdvice;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.context.request.NativeWebRequest;
-import org.springframework.web.servlet.HandlerExceptionResolver;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * User: Zhang Kaitao
- *
Date: 14-2-12
- *
Version: 1.0
- */
-public class DefaultExceptionHandler implements HandlerExceptionResolver {
-
-
- @Override
- public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) {
- ModelAndView mv = new ModelAndView();
- if (e instanceof AuthorizationException) {
-
- mv.setViewName("redirect:/login");
- }
- return mv;
- }
-}
+package com.exception;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.shiro.authz.AuthorizationException;
+import org.springframework.web.servlet.HandlerExceptionResolver;
+import org.springframework.web.servlet.ModelAndView;
+
+/**
+ *
User: Zhang Kaitao
+ *
Date: 14-2-12
+ *
Version: 1.0
+ */
+public class DefaultExceptionHandler implements HandlerExceptionResolver {
+ Logger log = Logger.getLogger(DefaultExceptionHandler.class);
+
+ @Override
+ public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) {
+ ModelAndView mv = new ModelAndView();
+ if (e instanceof AuthorizationException) {
+ mv.setViewName("unathorized");
+ } else {
+ e.printStackTrace();
+ mv.setViewName("error");
+ }
+ return mv;
+ }
+}
diff --git a/src/main/java/com/giit/www/filter/FormLoginFilter.java b/src/main/java/com/filter/FormLoginFilter.java
similarity index 62%
rename from src/main/java/com/giit/www/filter/FormLoginFilter.java
rename to src/main/java/com/filter/FormLoginFilter.java
index 3d9d408..691c5c3 100644
--- a/src/main/java/com/giit/www/filter/FormLoginFilter.java
+++ b/src/main/java/com/filter/FormLoginFilter.java
@@ -1,62 +1,63 @@
-package com.giit.www.filter;
-
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.authc.UsernamePasswordToken;
-import org.apache.shiro.web.filter.PathMatchingFilter;
-import org.apache.shiro.web.util.WebUtils;
-
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-public class FormLoginFilter extends PathMatchingFilter {
-
- private String loginUrl = "/login";
- private String successUrl = "/";
-
- @Override
- protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
- if (SecurityUtils.getSubject().isAuthenticated()) {
- return true;//已经登录过
- }
- HttpServletRequest req = (HttpServletRequest) request;
- HttpServletResponse resp = (HttpServletResponse) response;
- if (isLoginRequest(req)) {
- if ("post".equalsIgnoreCase(req.getMethod())) {//form表单提交
- boolean loginSuccess = login(req); //登录
- if (loginSuccess) {
- return true;
- }
- }
- }
- return true;
- }
-
- private boolean redirectToSuccessUrl(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- WebUtils.redirectToSavedRequest(req, resp, successUrl);
- return false;
- }
-
- private void saveRequestAndRedirectToLogin(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- WebUtils.saveRequest(req);
- WebUtils.issueRedirect(req, resp, loginUrl);
- }
-
- private boolean login(HttpServletRequest req) {
- String username = req.getParameter("username");
- String password = req.getParameter("password");
- try {
- SecurityUtils.getSubject().login(new UsernamePasswordToken(username, password));
- } catch (Exception e) {
- req.setAttribute("shiroLoginFailure", e.getClass());
- return false;
- }
- return true;
- }
-
- private boolean isLoginRequest(HttpServletRequest req) {
- return pathsMatch(loginUrl, WebUtils.getPathWithinApplication(req));
- }
-}
+package com.filter;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.web.filter.PathMatchingFilter;
+import org.apache.shiro.web.util.WebUtils;
+
+public class FormLoginFilter extends PathMatchingFilter {
+
+ private String loginFormUrl = "/login";
+ private String loginUrl = "/login.jsp";
+
+ @Override
+ protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
+ if (SecurityUtils.getSubject().isAuthenticated()) {
+ return true;//已经登录过
+ }
+ boolean flag = false;
+ HttpServletRequest req = (HttpServletRequest) request;
+ if (isLoginRequest(loginUrl,req)) {
+ flag = true;
+ } else if (isLoginRequest(loginFormUrl,req)) {
+ if ("post".equalsIgnoreCase(req.getMethod())) {//form表单提交
+ login(req); //登录
+ flag = true;
+ }
+ }
+ if(!flag) {
+ WebUtils.issueRedirect(request, response, loginUrl, request.getParameterMap());
+ }
+ return flag;
+ }
+
+ /*private boolean redirectToSuccessUrl(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ WebUtils.redirectToSavedRequest(req, resp, successUrl);
+ return false;
+ }
+
+ private void saveRequestAndRedirectToLogin(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ WebUtils.saveRequest(req);
+ WebUtils.issueRedirect(req, resp, loginUrl);
+ }*/
+
+ private boolean login(HttpServletRequest req) {
+ String username = req.getParameter("username");
+ String password = req.getParameter("password");
+ try {
+ SecurityUtils.getSubject().login(new UsernamePasswordToken(username, password));
+ } catch (Exception e) {
+ req.setAttribute("shiroLoginFailure", e.getClass().getName());
+ return false;
+ }
+ return true;
+ }
+
+ private boolean isLoginRequest(String url,HttpServletRequest req) {
+ return pathsMatch(url, WebUtils.getPathWithinApplication(req));
+ }
+}
diff --git a/src/main/java/com/giit/www/college/controller/ClazzController.java b/src/main/java/com/giit/www/college/controller/ClazzController.java
deleted file mode 100644
index 1459717..0000000
--- a/src/main/java/com/giit/www/college/controller/ClazzController.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.giit.www.college.controller;
-
-import com.giit.www.college.service.ClazzBiz;
-import com.giit.www.util.TermContainer;
-import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import javax.annotation.Resource;
-
-/**
- * Created by c0de8ug on 16-2-11.
- */
-@Controller
-@RequestMapping("clazz.do")
-public class ClazzController {
-
- @Resource(name = "clazzBizImpl")
- private ClazzBiz clazzBiz;
-
- @RequiresRoles("admin")
- @RequestMapping("add")
- public String add(String deptName, String specName, String year) {
- clazzBiz.add(deptName, specName, year);
- return "redirect:/clazz.do/clazz.view";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("delete")
- public String delete(int clazzId) {
- clazzBiz.delete(clazzId);
- return "redirect:/clazz.do/clazz.view";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("clazz.view")
- public String findAll(Model m) {
- m.addAttribute("clazzList", clazzBiz.findAll());
- return "/admin/college/clazz";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("clazz_add.view")
- public String findDeptAndSpec(Model m) {
- m.addAttribute("deptAndSpecJson", clazzBiz.findDeptAndSpecJson());
- m.addAttribute("deptNameList", clazzBiz.findDeptNameList());
- m.addAttribute("termList", TermContainer.getTermList());
- return "/admin/college/clazz_add";
- }
-}
diff --git a/src/main/java/com/giit/www/college/controller/CourseController.java b/src/main/java/com/giit/www/college/controller/CourseController.java
deleted file mode 100644
index 245cdc1..0000000
--- a/src/main/java/com/giit/www/college/controller/CourseController.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.giit.www.college.controller;
-
-import com.giit.www.college.service.CourseBiz;
-import com.giit.www.entity.Course;
-import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import javax.annotation.Resource;
-
-/**
- * Created by c0de8ug on 16-2-12.
- */
-@Controller
-@RequestMapping("course.do")
-public class CourseController {
- @Resource(name = "courseBizImpl")
- private CourseBiz courseBiz;
-
- @RequiresRoles("admin")
- @RequestMapping("course.view")
- private String courseView(Model m) {
- m.addAttribute("courseList", courseBiz.findAll());
- return "/admin/college/course";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("course_add.view")
- private String courseAddView(Model m) {
- m.addAttribute("specNameList", courseBiz.findAllSpecName());
- return "/admin/college/course_add";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("add")
- private String add(Course course) {
- courseBiz.add(course);
- return "redirect:/course.do/course.view";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("delete")
- private String delete(String courseTitle) {
- courseBiz.delete(courseTitle);
- return "redirect:/course.do/course.view";
- }
-}
-
diff --git a/src/main/java/com/giit/www/college/controller/DeptController.java b/src/main/java/com/giit/www/college/controller/DeptController.java
deleted file mode 100644
index 0ad9f8a..0000000
--- a/src/main/java/com/giit/www/college/controller/DeptController.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.giit.www.college.controller;
-
-import com.giit.www.college.service.DeptBiz;
-import com.giit.www.entity.Dept;
-import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import javax.annotation.Resource;
-
-/**
- * Created by c0de8ug on 16-2-10.
- */
-
-@Controller
-@RequestMapping("dept.do")
-public class DeptController {
-
- @Resource(name = "deptBizImpl")
- private DeptBiz deptBiz;
-
- @RequiresRoles("admin")
- @RequestMapping("dept.view")
- public String deptView(Model m) {
- m.addAttribute("deptList", deptBiz.findAll());
- return "/admin/college/dept";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("dept_add.view")
- public String deptAddView(Model m) {
- return "/admin/college/dept_add";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("dept_update.view")
- public String deptUpdateView(Model m) {
- return "/admin/college/dept_update";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("add")
- public String add(String deptName) {
- deptBiz.add(deptName);
- return "redirect:/dept.do/dept.view";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("update")
- public String update(Dept dept) {
- deptBiz.update(dept);
- return "redirect:/dept.do/dept.view";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("delete")
- public String delete(int deptId) {
- deptBiz.delete(deptId);
- return "redirect:/dept.do/dept.view";
- }
-
-
-}
diff --git a/src/main/java/com/giit/www/college/controller/OrderBookController.java b/src/main/java/com/giit/www/college/controller/OrderBookController.java
deleted file mode 100644
index 5a67f72..0000000
--- a/src/main/java/com/giit/www/college/controller/OrderBookController.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.giit.www.college.controller;
-
-import com.giit.www.college.service.OrderBookBiz;
-import com.giit.www.entity.Section;
-import com.giit.www.entity.custom.ChangedItems;
-import com.giit.www.entity.custom.OrderBookReviewVo;
-import com.giit.www.entity.custom.OrderBookVo;
-import com.giit.www.util.TermContainer;
-import org.apache.shiro.authz.annotation.Logical;
-import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.http.HttpStatus;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.ResponseStatus;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by c0de8ug on 16-2-13.
- */
-//TODO URL我自己定义全小写
-@Controller
-@RequestMapping("orderbook.do")
-
-public class OrderBookController {
- @Resource(name = "orderBookBizImpl")
- private OrderBookBiz orderBookBiz;
-
- @RequiresRoles(value = {"admin", "teacher"}, logical = Logical.OR)
- @RequestMapping("orderbook.view")
- public String orderBookView(Model m, HttpSession httpSession) {
- String staffId = (String) httpSession.getAttribute("username");
-
- List sectionList = orderBookBiz.findSelectedSection(staffId, TermContainer.now());
- int courseCount = sectionList.size();
- m.addAttribute("selectedSectionList", sectionList);
- m.addAttribute("courseCount", courseCount);
- return "/teacher/orderbook";
- }
-
- @RequiresRoles(value = {"admin", "teacher"}, logical = Logical.OR)
- @RequestMapping("orderbook_review.view")
- public String orderBookReviewView(Model m, HttpSession session) {
- //TODO 放到SESSION方便处理
- session.setAttribute("notReviewedBookList", orderBookBiz.findAllNotReviewedBook());
- return "/teacher/orderbook_review";
- }
-
- @RequiresRoles(value = {"admin", "teacher"}, logical = Logical.OR)
- @RequestMapping("orderbook_add.view")
- public String orderBookAddView(Model m) {
- return "/teacher/orderbook_add";
- }
-
- @RequiresRoles(value = {"admin", "teacher"}, logical = Logical.OR)
- @RequestMapping("orderbook_added.view")
- public String orderBookAddedView(Model m, HttpSession session) {
- String staffId = (String) session.getAttribute("username");
- m.addAttribute("addedBookInfoList", orderBookBiz.findAddedBookInfoList(staffId));
- return "/teacher/orderbook_added";
- }
-
- @RequiresRoles(value = {"admin", "teacher"}, logical = Logical.OR)
- @RequestMapping("add")
- public String add(HttpServletRequest request, HttpSession session) {
- Map map = request.getParameterMap();
- OrderBookVo orderBookVo = new OrderBookVo();
- orderBookVo.setStaffId((String) session.getAttribute("username"));
- orderBookVo.setMap(map);
- orderBookBiz.add(orderBookVo);
- return "redirect:/orderbook.do/orderbook.view";
- }
-
- @RequiresRoles(value = {"admin", "teacher"}, logical = Logical.OR)
- @RequestMapping("update")
- @ResponseStatus(value = HttpStatus.OK)
- public void update(@RequestBody ChangedItems changedItems, HttpSession session) {
- orderBookBiz.update(changedItems, (String) session.getAttribute("username"));
- }
-
- @RequiresRoles(value = {"admin", "teacher"}, logical = Logical.OR)
- @RequestMapping("audit")
- public String audit(HttpSession session) {
- List orderBookReviewVoList = (List) session.getAttribute("notReviewedBookList");
- orderBookBiz.audit(orderBookReviewVoList);
- return "redirect:/orderbook.do/orderbook_review.view";
- }
-}
diff --git a/src/main/java/com/giit/www/college/controller/SectionController.java b/src/main/java/com/giit/www/college/controller/SectionController.java
deleted file mode 100644
index 652c728..0000000
--- a/src/main/java/com/giit/www/college/controller/SectionController.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.giit.www.college.controller;
-
-import com.giit.www.college.service.SectionBiz;
-import com.giit.www.entity.Section;
-import com.giit.www.entity.Timetable;
-import com.giit.www.util.TermContainer;
-import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.RequestMapping;
-import sun.misc.Timeable;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpSession;
-
-/**
- * Created by c0de8ug on 16-2-12.
- */
-@Controller
-@RequestMapping("section.do")
-public class SectionController {
- @Resource(name = "sectionBizImpl")
- private SectionBiz sectionBiz;
-
- @RequiresRoles("admin")
- @RequestMapping("section.view")
- public String sectionView(Model m) {
- m.addAttribute("sectionList", sectionBiz.findAllCustom());
- return "/admin/college/section";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("section_add.view")
- public String sectionAddView(Model m) {
- m.addAttribute("courseTitleList", sectionBiz.findAllCourseTitle());
- m.addAttribute("staffList", sectionBiz.findAllStaff());
- m.addAttribute("termList", TermContainer.getTermList());
- return "/admin/college/section_add";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("section_timetable_add.view")
- public String sectionTimetableAdd(Model m) {
- return "/admin/college/section_timetable_add";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("add")
- public String add(Section section, HttpSession session) {
- sectionBiz.add(section);
- return "redirect:section.view";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("addTimetable")
- public String addTimetable(Timetable timetable) {
- sectionBiz.addTimetable(timetable);
- return "redirect:section.view";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("delete")
- public String delete(int secId) {
- sectionBiz.delete(secId);
- return "redirect:section.view";
- }
-}
diff --git a/src/main/java/com/giit/www/college/controller/SpecController.java b/src/main/java/com/giit/www/college/controller/SpecController.java
deleted file mode 100644
index d192f2c..0000000
--- a/src/main/java/com/giit/www/college/controller/SpecController.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.giit.www.college.controller;
-
-import com.giit.www.college.service.DeptBiz;
-import com.giit.www.college.service.SpecBiz;
-import com.giit.www.entity.Spec;
-import org.apache.ibatis.annotations.Param;
-import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import javax.annotation.Resource;
-
-/**
- * Created by c0de8ug on 16-2-11.
- */
-@Controller
-@RequestMapping("spec.do")
-public class SpecController {
-
- @Resource(name = "specBizImpl")
- SpecBiz specBiz;
-
- @RequiresRoles("admin")
- @RequestMapping("spec_add.view")
- public String specAddView(Model m) {
- m.addAttribute("deptNameList", specBiz.findDpet());
- return "/admin/college/spec_add";
- }
-
- //TODO 该名字deptAndSpec不好,但是不知道如何命名-, -
- @RequiresRoles("admin")
- @RequestMapping("spec.view")
- public String specView(Model m) {
- m.addAttribute("deptAndSpec", specBiz.findDeptAndSpec());
- return "/admin/college/spec";
- }
- @RequiresRoles("admin")
- @RequestMapping("spec_update.view")
- public String specUpdateView(Model m) {
- return "/admin/college/spec_update";
- }
- @RequiresRoles("admin")
- @RequestMapping("update")
- public String update(@Param("specName") String newSpecName, @Param("newSpecName") String specName) {
- specBiz.update(specName, newSpecName);
- return "redirect:/spec.do/spec.view";
- }
- @RequiresRoles("admin")
- @RequestMapping("add")
- public String add(Spec spec) {
- specBiz.add(spec);
- return "redirect:/spec.do/spec.view";
- }
- @RequiresRoles("admin")
- @RequestMapping("delete")
- public String delete(String specName) {
- specBiz.delete(specName);
- return "redirect:/spec.do/spec.view";
- }
-
-}
-
diff --git a/src/main/java/com/giit/www/college/controller/StudentController.java b/src/main/java/com/giit/www/college/controller/StudentController.java
deleted file mode 100644
index d759dc1..0000000
--- a/src/main/java/com/giit/www/college/controller/StudentController.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.giit.www.college.controller;
-
-import com.giit.www.college.service.StudentBiz;
-import com.giit.www.entity.Student;
-import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.annotation.Resource;
-import javax.servlet.annotation.MultipartConfig;
-import java.io.IOException;
-
-/**
- * Created by c0de8ug on 16-2-12.
- */
-@Controller
-@RequestMapping("student.do")
-public class StudentController {
-
- @Resource(name = "studentBizImpl")
- StudentBiz studentBiz;
-
- @RequiresRoles("admin")
- @RequestMapping("student.view")
- public String studentView(Model m) {
- //TODO 将biz命名为和业务有关的函数方法,不知道是否正确留个吭
- m.addAttribute("studentList", studentBiz.studentView());
- return "/admin/college/student";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("student_add.view")
- public String studentAddView(Model m) {
-
- return "/admin/college/student_add";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("student_update.view")
- public String studentUpdateView(Model m) {
-
- return "/admin/college/student_update";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("add")
- public String add(Model m, MultipartFile pic, Student student) throws IOException {
- studentBiz.add(student, pic);
- return "redirect:/student.do/student.view";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("delete")
- public String delete(Model m, int studentId) {
- studentBiz.delete(studentId);
- return "redirect:/student.do/student.view";
- }
-
-}
diff --git a/src/main/java/com/giit/www/college/dao/BookDao.java b/src/main/java/com/giit/www/college/dao/BookDao.java
deleted file mode 100644
index 367ad19..0000000
--- a/src/main/java/com/giit/www/college/dao/BookDao.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.giit.www.college.dao;
-
-import com.giit.www.entity.Book;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-14.
- */
-public interface BookDao {
-
- public void add(Book book);
-
- public void delete(@Param("bookTitle") String bookTitle, @Param("isbn") String isbn);
-
- public Book find(@Param("bookTitle") String bookTitle, @Param("isbn") String isbn);
-}
diff --git a/src/main/java/com/giit/www/college/dao/BookDao.xml b/src/main/java/com/giit/www/college/dao/BookDao.xml
deleted file mode 100644
index f9b03e7..0000000
--- a/src/main/java/com/giit/www/college/dao/BookDao.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
- INSERT INTO book(book_title,isbn,date_of_printing,author,press,category,unit_price)
- VALUES(#{bookTitle},#{isbn},#{dateOfPrinting},#{author},#{press},#{category},#{unitPrice})
-
-
-
-
-
- DELETE FROM book WHERE book_title = #{bookTitle} AND isbn = #{isbn}
-
-
\ No newline at end of file
diff --git a/src/main/java/com/giit/www/college/dao/ClazzDao.java b/src/main/java/com/giit/www/college/dao/ClazzDao.java
deleted file mode 100644
index ffcdc37..0000000
--- a/src/main/java/com/giit/www/college/dao/ClazzDao.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.giit.www.college.dao;
-
-import com.giit.www.entity.Clazz;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-11.
- */
-public interface ClazzDao {
- public void add(Clazz clazz);
-
- public void delete(int clazzId);
-
- public List findAll();
-
- public int getClassCount(@Param("specName") String specName, @Param("year") String year);
-}
diff --git a/src/main/java/com/giit/www/college/dao/ClazzDao.xml b/src/main/java/com/giit/www/college/dao/ClazzDao.xml
deleted file mode 100644
index 6477267..0000000
--- a/src/main/java/com/giit/www/college/dao/ClazzDao.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- INSERT INTO class(class_id,class_name,year,spec_name) VALUES (#{clazzId},#{className},#{year},#{specName})
-
-
-
- DELETE FROM class WHERE class_id = #{value}
-
-
-
-
\ No newline at end of file
diff --git a/src/main/java/com/giit/www/college/dao/CourseDao.java b/src/main/java/com/giit/www/college/dao/CourseDao.java
deleted file mode 100644
index f430df2..0000000
--- a/src/main/java/com/giit/www/college/dao/CourseDao.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.giit.www.college.dao;
-
-import com.giit.www.entity.Course;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-12.
- */
-public interface CourseDao {
- public List findAll();
-
- public void add(Course course);
-
- public void delete(String courseTitle);
-
- public List findAllCourseTitle();
-}
diff --git a/src/main/java/com/giit/www/college/dao/CourseDao.xml b/src/main/java/com/giit/www/college/dao/CourseDao.xml
deleted file mode 100644
index 9c39a96..0000000
--- a/src/main/java/com/giit/www/college/dao/CourseDao.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- DELETE FROM course WHERE course_title=#{value}
-
-
-
-
\ No newline at end of file
diff --git a/src/main/java/com/giit/www/college/dao/DeptDao.java b/src/main/java/com/giit/www/college/dao/DeptDao.java
deleted file mode 100644
index a190d66..0000000
--- a/src/main/java/com/giit/www/college/dao/DeptDao.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.giit.www.college.dao;
-
-import com.giit.www.entity.custom.DeptAndSpec;
-import com.giit.www.entity.Dept;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-10.
- */
-public interface DeptDao {
- public List findAll();
-
- public void add(String deptName);
-
- public String findIdByName(String deptName);
-
- public void update(Dept dept);
-
- public void delete(int deptId);
-
- public List findAllDeptName();
-
-}
diff --git a/src/main/java/com/giit/www/college/dao/DeptDao.xml b/src/main/java/com/giit/www/college/dao/DeptDao.xml
deleted file mode 100644
index f1c8d59..0000000
--- a/src/main/java/com/giit/www/college/dao/DeptDao.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- UPDATE department SET dept_name = #{deptName} WHERE dept_id = #{deptId}
-
-
-
- INSERT INTO department(dept_name) VALUES(#{value})
-
-
-
- DELETE FROM department WHERE dept_id = #{value}
-
-
\ No newline at end of file
diff --git a/src/main/java/com/giit/www/college/dao/OrderBookDao.java b/src/main/java/com/giit/www/college/dao/OrderBookDao.java
deleted file mode 100644
index 7194b9b..0000000
--- a/src/main/java/com/giit/www/college/dao/OrderBookDao.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.giit.www.college.dao;
-
-import com.giit.www.entity.OrderBook;
-import com.giit.www.entity.custom.AddedBookVo;
-import com.giit.www.entity.custom.ChangedItems;
-import com.giit.www.entity.custom.OrderBookReviewVo;
-import com.giit.www.entity.custom.ReviewedBookVo;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-13.
- */
-public interface OrderBookDao {
- public void add(OrderBook orderBook);
-
- public List findAddedBookInfoList(String staffId);
-
- public int usedByOtherSec(@Param("bookTitle") String bookTitle, @Param("isbn") String isbn, @Param("secId") int secId);
-
- public void delete(@Param("secId") int secId, @Param("bookTitle") String bookTitle, @Param("isbn") String isbn);
-
- public List findAllNotReviewedBook();
-
- public void audit(@Param("secId") int secId, @Param("bookTitle") String bookTitle, @Param("isbn") String isbn);
-
- public List findAllReviewedBook();
-}
diff --git a/src/main/java/com/giit/www/college/dao/OrderBookDao.xml b/src/main/java/com/giit/www/college/dao/OrderBookDao.xml
deleted file mode 100644
index 3ea6df3..0000000
--- a/src/main/java/com/giit/www/college/dao/OrderBookDao.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- INSERT INTO order_book(staff_id,sec_id,book_title,isbn,remark,approval) VALUES(#{staffId},#{secId},#{bookTitle},#{isbn},#{remark},#{approval})
-
-
-
-
-
-
-
-
-
-
-
-
- DELETE FROM order_book WHERE sec_id = #{secId} AND book_title = #{bookTitle} AND isbn = #{isbn}
-
-
-
- UPDATE order_book SET approval = 1 WHERE sec_id = #{secId} AND book_title = #{bookTitle} AND isbn=#{isbn}
-
-
\ No newline at end of file
diff --git a/src/main/java/com/giit/www/college/dao/SectionDao.java b/src/main/java/com/giit/www/college/dao/SectionDao.java
deleted file mode 100644
index 2aa4324..0000000
--- a/src/main/java/com/giit/www/college/dao/SectionDao.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.giit.www.college.dao;
-
-import com.giit.www.entity.Section;
-import com.giit.www.entity.custom.SectionCustom;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-12.
- */
-public interface SectionDao {
-
- //TODO 狗血命名!!
- public List findAllCustom();
-
- public void delete(int sectionId);
-
- public void add(Section section);
-
- public List findSelectedSection(@Param("staffId") String staffId, @Param("year") String year);
-
- int getSecId(String item, String s);
-
- public List findAll();
-}
diff --git a/src/main/java/com/giit/www/college/dao/SectionDao.xml b/src/main/java/com/giit/www/college/dao/SectionDao.xml
deleted file mode 100644
index 6cc7ecc..0000000
--- a/src/main/java/com/giit/www/college/dao/SectionDao.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- INSERT INTO section(course_title,year,staff_id) VALUES(#{courseTitle},#{year},#{staffId})
-
-
-
- DELETE FROM section WHERE sec_id = #{value}
-
-
\ No newline at end of file
diff --git a/src/main/java/com/giit/www/college/dao/SpecDao.java b/src/main/java/com/giit/www/college/dao/SpecDao.java
deleted file mode 100644
index 62ec081..0000000
--- a/src/main/java/com/giit/www/college/dao/SpecDao.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.giit.www.college.dao;
-
-import com.giit.www.entity.Spec;
-import com.giit.www.entity.custom.DeptAndSpec;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-11.
- */
-public interface SpecDao {
- public List findAll();
-
- public void update(@Param("specName") String specName, @Param("newSpecName") String newSpecName);
-
- public void add(Spec spec);
-
- public void delete(String specName);
-
- public List findDeptAndSpec();
-
- public String findIdByName(String specName);
-
- public List findAllSpecName();
-}
diff --git a/src/main/java/com/giit/www/college/dao/SpecDao.xml b/src/main/java/com/giit/www/college/dao/SpecDao.xml
deleted file mode 100644
index 478dfc7..0000000
--- a/src/main/java/com/giit/www/college/dao/SpecDao.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- UPDATE speciality SET spec_name = #{newSpecName} WHERE spec_name = #{specName}
-
-
-
- INSERT INTO speciality(dept_name,spec_name) VALUES(#{deptName},#{specName})
-
-
-
- DELETE FROM speciality WHERE spec_name = #{value}
-
-
\ No newline at end of file
diff --git a/src/main/java/com/giit/www/college/dao/StaffDao.java b/src/main/java/com/giit/www/college/dao/StaffDao.java
deleted file mode 100644
index 5b0a5a2..0000000
--- a/src/main/java/com/giit/www/college/dao/StaffDao.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.giit.www.college.dao;
-
-import com.giit.www.entity.Staff;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-12.
- */
-public interface StaffDao {
- public List findAllName();
-
- public String findIdByName(String staffId);
-
- public List findAll();
-
- void add(Staff staff);
-}
diff --git a/src/main/java/com/giit/www/college/dao/StaffDao.xml b/src/main/java/com/giit/www/college/dao/StaffDao.xml
deleted file mode 100644
index 65c8504..0000000
--- a/src/main/java/com/giit/www/college/dao/StaffDao.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- UPDATE staff SET spec_name = #{newSpecName} WHERE spec_name = #{specName}
-
-
-
- INSERT INTO staff(staff_id,staff_name) VALUES(#{staffId},#{staffName})
-
-
-
- DELETE FROM staff WHERE staff_id = #{value}
-
-
\ No newline at end of file
diff --git a/src/main/java/com/giit/www/college/dao/StudentDao.java b/src/main/java/com/giit/www/college/dao/StudentDao.java
deleted file mode 100644
index aeafd8d..0000000
--- a/src/main/java/com/giit/www/college/dao/StudentDao.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.giit.www.college.dao;
-
-import com.giit.www.entity.Student;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-12.
- */
-public interface StudentDao {
- public List findAll();
-
- public void add(Student student);
-
- public void update(Student student);
-
- public void delete(int studentId);
-}
diff --git a/src/main/java/com/giit/www/college/dao/StudentDao.xml b/src/main/java/com/giit/www/college/dao/StudentDao.xml
deleted file mode 100644
index bed5638..0000000
--- a/src/main/java/com/giit/www/college/dao/StudentDao.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- INSERT INTO student
- (
- student_id,student_name,id_card,year,class_name,
- telephone_number,student_origin_base,gender,pic_path
- )
- VALUES
- (
- #{studentId},
- #{studentName},
- #{idCard},
- #{year},
- #{className},
- #{telephoneNumber},
- #{studentOriginBase},
- #{gender},
- #{picPath})
-
-
- DELETE FROM student WHERE student_id = #{value}
-
-
-
- UPDATE student
- SET student_name = #{studentName},id_card = #{IdCard},
- year = #{year},class_name = #{className},telephone_number = #{telephoneNumber},
- student_origin_base = #{studentOriginBase},gender = #{gender},photo = #{photo}
- WHERE student_id = #{studentId}
-
-
-
\ No newline at end of file
diff --git a/src/main/java/com/giit/www/college/dao/TakesDao.java b/src/main/java/com/giit/www/college/dao/TakesDao.java
deleted file mode 100644
index d517ea4..0000000
--- a/src/main/java/com/giit/www/college/dao/TakesDao.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.giit.www.college.dao;
-
-import org.apache.ibatis.annotations.Param;
-
-/**
- * Created by c0de8ug on 16-2-16.
- */
-
-public interface TakesDao {
- public int getStdCountInSection(int secId);
-
- public void add(@Param("secId") int secId, @Param("stdId") String stdId);
-
- public void delete(@Param("secId") int secId, @Param("stdId") String stdId);
-}
diff --git a/src/main/java/com/giit/www/college/dao/TakesDao.xml b/src/main/java/com/giit/www/college/dao/TakesDao.xml
deleted file mode 100644
index d56c7f1..0000000
--- a/src/main/java/com/giit/www/college/dao/TakesDao.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
- INSERT INTO takes(student_id,sec_Id) VALUES(#{stdId},#{secId})
-
-
-
- DELETE FROM takes WHERE student_id = #{stdId} AND sec_id = #{secId}
-
-
\ No newline at end of file
diff --git a/src/main/java/com/giit/www/college/dao/TimetableDao.java b/src/main/java/com/giit/www/college/dao/TimetableDao.java
deleted file mode 100644
index 2af97e8..0000000
--- a/src/main/java/com/giit/www/college/dao/TimetableDao.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.giit.www.college.dao;
-
-import com.giit.www.entity.Timetable;
-
-/**
- * Created by c0de8ug on 16-2-13.
- */
-public interface TimetableDao {
- public void add(Timetable timetable);
-
- public void delete(int secId);
-}
diff --git a/src/main/java/com/giit/www/college/dao/TimetableDao.xml b/src/main/java/com/giit/www/college/dao/TimetableDao.xml
deleted file mode 100644
index 255f1bf..0000000
--- a/src/main/java/com/giit/www/college/dao/TimetableDao.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
- INSERT INTO timetable(sec_id,time,week,weeks,classroom) VALUES(#{secId},#{time},#{week},#{weeks},#{classroom})
-
-
-
- DELETE FROM timetable WHERE sec_id = #{value}
-
-
\ No newline at end of file
diff --git a/src/main/java/com/giit/www/college/service/ClazzBiz.java b/src/main/java/com/giit/www/college/service/ClazzBiz.java
deleted file mode 100644
index 994203f..0000000
--- a/src/main/java/com/giit/www/college/service/ClazzBiz.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.giit.www.college.service;
-
-import com.giit.www.entity.custom.DeptAndSpec;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-11.
- */
-public interface ClazzBiz {
- public void add(String deptName, String specName, String year);
-
- public void delete(int clazzId);
-
- public List findAll();
-
- public List findDeptAndSpec();
-
- public String findDeptAndSpecJson();
-
- public List findDeptNameList();
-}
diff --git a/src/main/java/com/giit/www/college/service/CourseBiz.java b/src/main/java/com/giit/www/college/service/CourseBiz.java
deleted file mode 100644
index 17ba9fb..0000000
--- a/src/main/java/com/giit/www/college/service/CourseBiz.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.giit.www.college.service;
-
-import com.giit.www.entity.Course;
-import org.springframework.ui.Model;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-12.
- */
-public interface CourseBiz {
- public List findAll();
-
- public List findAllSpecName();
-
- public void add(Course course);
-
- public void delete(String courseTitle);
-}
diff --git a/src/main/java/com/giit/www/college/service/DeptBiz.java b/src/main/java/com/giit/www/college/service/DeptBiz.java
deleted file mode 100644
index 4dffa1e..0000000
--- a/src/main/java/com/giit/www/college/service/DeptBiz.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.giit.www.college.service;
-
-import com.giit.www.entity.custom.DeptAndSpec;
-import com.giit.www.entity.Dept;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-11.
- */
-public interface DeptBiz {
- public List findAll();
-
- public void add(String deptName);
-
- public void update(Dept dept);
-
- public void delete(int deptId);
-
-}
diff --git a/src/main/java/com/giit/www/college/service/OrderBookBiz.java b/src/main/java/com/giit/www/college/service/OrderBookBiz.java
deleted file mode 100644
index 54ea757..0000000
--- a/src/main/java/com/giit/www/college/service/OrderBookBiz.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.giit.www.college.service;
-
-import com.giit.www.entity.Section;
-import com.giit.www.entity.custom.AddedBookVo;
-import com.giit.www.entity.custom.ChangedItems;
-import com.giit.www.entity.custom.OrderBookReviewVo;
-import com.giit.www.entity.custom.OrderBookVo;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-13.
- */
-public interface OrderBookBiz {
- public List findSelectedSection(String staffId, String year);
-
- public void add(OrderBookVo orderBookVo);
-
- public List findAddedBookInfoList(String staffId);
-
- public void update(ChangedItems changedItems, String staffId);
-
- public void audit(List orderBookReviewVoList);
-
- public List findAllNotReviewedBook();
-}
diff --git a/src/main/java/com/giit/www/college/service/SectionBiz.java b/src/main/java/com/giit/www/college/service/SectionBiz.java
deleted file mode 100644
index ff90a9f..0000000
--- a/src/main/java/com/giit/www/college/service/SectionBiz.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.giit.www.college.service;
-
-import com.giit.www.entity.Section;
-import com.giit.www.entity.Staff;
-import com.giit.www.entity.Timetable;
-import com.giit.www.entity.custom.SectionCustom;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-12.
- */
-public interface SectionBiz {
- public void delete(int sectionId);
-
- public void add(Section section);
-
- public List findAllCustom();
-
- public List findAllCourseTitle();
-
- public List findAllStaff();
-
- public void addTimetable(Timetable timetable);
-}
diff --git a/src/main/java/com/giit/www/college/service/SpecBiz.java b/src/main/java/com/giit/www/college/service/SpecBiz.java
deleted file mode 100644
index 9696c10..0000000
--- a/src/main/java/com/giit/www/college/service/SpecBiz.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.giit.www.college.service;
-
-import com.giit.www.entity.Spec;
-import com.giit.www.entity.custom.DeptAndSpec;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-11.
- */
-public interface SpecBiz {
-
- public void update(String specName, String newSpecName);
-
- public void add(Spec spec);
-
- public void delete(String specName);
-
- public List findDeptAndSpec();
-
- public List findDpet();
-}
diff --git a/src/main/java/com/giit/www/college/service/StudentBiz.java b/src/main/java/com/giit/www/college/service/StudentBiz.java
deleted file mode 100644
index 7db231f..0000000
--- a/src/main/java/com/giit/www/college/service/StudentBiz.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.giit.www.college.service;
-
-import com.giit.www.entity.Student;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-13.
- */
-
-public interface StudentBiz {
- public List studentView();
-
- public void add(Student student, MultipartFile pic) throws IOException;
-
- public void update(Student student);
-
- public void delete(int studentId);
-}
diff --git a/src/main/java/com/giit/www/college/service/impl/ClazzBizImpl.java b/src/main/java/com/giit/www/college/service/impl/ClazzBizImpl.java
deleted file mode 100644
index 55f29d7..0000000
--- a/src/main/java/com/giit/www/college/service/impl/ClazzBizImpl.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.giit.www.college.service.impl;
-
-import com.giit.www.college.dao.ClazzDao;
-import com.giit.www.college.dao.DeptDao;
-import com.giit.www.college.dao.SpecDao;
-import com.giit.www.college.service.ClazzBiz;
-import com.giit.www.entity.Clazz;
-import com.giit.www.entity.custom.DeptAndSpec;
-import com.google.gson.Gson;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-11.
- */
-@Service
-public class ClazzBizImpl implements ClazzBiz {
-
- @Resource
- private ClazzDao clazzDao;
- @Resource
- private DeptDao deptDao;
- @Resource
- private SpecDao specDao;
-
- public void add(String deptName, String specName, String year) {
- Clazz clazz = new Clazz();
- clazz.setSpecName(specName);
- int classCount = clazzDao.getClassCount(specName, year) + 1;
- clazz.setClazzId(year.substring(2) + deptDao.findIdByName(deptName) + specDao.findIdByName(specName) + classCount);
- clazz.setYear(year);
- clazzDao.add(clazz);
- }
-
- public void delete(int clazzId) {
- clazzDao.delete(clazzId);
- }
-
- public List findAll() {
- return clazzDao.findAll();
- }
-
- @Override
- public List findDeptAndSpec() {
- return specDao.findDeptAndSpec();
- }
-
-
- @Override
- public String findDeptAndSpecJson() {
- Gson gson = new Gson();
-
- List deptAndSpecList = specDao.findDeptAndSpec();
-
- HashMap> map = new HashMap();
-
-
- for (DeptAndSpec deptAndSpec : deptAndSpecList) {
- map.put(deptAndSpec.getDeptName(), deptAndSpec.getSpecName());
- }
- String json = gson.toJson(map);
- return json;
- }
-
- //TODO 在这里感觉不应该查询两次应该使用上面的结果keyset,磁盘的开销远大于运算,如果开一个deptAndSpecList变量存储这个变量是线程安全的么,留坑= =!
- //感觉这里应该是取决于biz的BEAN在spring中的作用域
- @Override
- public List findDeptNameList() {
- return deptDao.findAllDeptName();
- }
-
-
-}
diff --git a/src/main/java/com/giit/www/college/service/impl/CourseBizImpl.java b/src/main/java/com/giit/www/college/service/impl/CourseBizImpl.java
deleted file mode 100644
index 473f663..0000000
--- a/src/main/java/com/giit/www/college/service/impl/CourseBizImpl.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.giit.www.college.service.impl;
-
-import com.giit.www.college.dao.CourseDao;
-import com.giit.www.college.dao.SpecDao;
-import com.giit.www.college.service.CourseBiz;
-import com.giit.www.entity.Course;
-import org.springframework.stereotype.Service;
-import org.springframework.ui.Model;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-12.
- */
-@Service
-public class CourseBizImpl implements CourseBiz {
-
- @Resource
- private CourseDao courseDao;
-
- @Resource
- private SpecDao specDao;
-
- @Override
- public List findAll() {
- return courseDao.findAll();
- }
-
- @Override
- public List findAllSpecName() {
- return specDao.findAllSpecName();
- }
-
- @Override
- public void add(Course course) {
- courseDao.add(course);
- }
-
- @Override
- public void delete(String courseTitle) {
- courseDao.delete(courseTitle);
- }
-}
diff --git a/src/main/java/com/giit/www/college/service/impl/DeptBizImpl.java b/src/main/java/com/giit/www/college/service/impl/DeptBizImpl.java
deleted file mode 100644
index f0c4e3b..0000000
--- a/src/main/java/com/giit/www/college/service/impl/DeptBizImpl.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.giit.www.college.service.impl;
-
-import com.giit.www.college.dao.DeptDao;
-import com.giit.www.college.service.DeptBiz;
-import com.giit.www.entity.custom.DeptAndSpec;
-import com.giit.www.entity.Dept;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-11.
- */
-
-@Service
-public class DeptBizImpl implements DeptBiz {
- @Resource
- private DeptDao deptDao;
-
- public List findAll() {
- return deptDao.findAll();
- }
-
- public void add(String deptName) {
- deptDao.add(deptName);
- }
-
- public void update(Dept dept) {
- deptDao.update(dept);
- }
-
- public void delete(int deptId) {
- deptDao.delete(deptId);
- }
-
-}
diff --git a/src/main/java/com/giit/www/college/service/impl/OrderBookBizImpl.java b/src/main/java/com/giit/www/college/service/impl/OrderBookBizImpl.java
deleted file mode 100644
index 089076d..0000000
--- a/src/main/java/com/giit/www/college/service/impl/OrderBookBizImpl.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package com.giit.www.college.service.impl;
-
-import com.giit.www.college.dao.BookDao;
-import com.giit.www.college.dao.OrderBookDao;
-import com.giit.www.college.dao.SectionDao;
-import com.giit.www.college.dao.TakesDao;
-import com.giit.www.college.service.OrderBookBiz;
-import com.giit.www.entity.Book;
-import com.giit.www.entity.OrderBook;
-import com.giit.www.entity.Section;
-import com.giit.www.entity.custom.AddedBookVo;
-import com.giit.www.entity.custom.ChangedItems;
-import com.giit.www.entity.custom.OrderBookReviewVo;
-import com.giit.www.entity.custom.OrderBookVo;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created by c0de8ug on 16-2-13.
- */
-@Service
-public class OrderBookBizImpl implements OrderBookBiz {
-
- @Resource
- OrderBookDao orderBookDao;
-
- @Resource
- SectionDao sectionDao;
-
- @Resource
- BookDao bookDao;
-
- @Resource
- TakesDao takesDao;
-
- public int ITEMNUM = 8;
-
- @Override
- public List findSelectedSection(String staffId, String year) {
- return sectionDao.findSelectedSection(staffId, year);
- }
-
- @Transactional
- @Override
- public void add(OrderBookVo orderBookVo) {
- String staffId = orderBookVo.getStaffId();
- Map forms = orderBookVo.getMap();
- Iterator iterator = forms.entrySet().iterator();
-
- while (iterator.hasNext()) {
- Map.Entry form = (Map.Entry) iterator.next();
- String[] items = form.getValue();
-
- int bookCount = (items.length - 1) / ITEMNUM;
- int j = 1;
- int secId = Short.valueOf(items[0]);
- for (int i = 0; i < bookCount; i++) {
-
- String bookTitle = items[j++].trim();
- String isbn = items[j++].trim();
- String dataOfPringting = items[j++].trim();
- String author = items[j++].trim();
- String press = items[j++].trim();
- String category = items[j++].trim();
- short unitPrice = 0;
- if (!items[j++].equals("")) {
- unitPrice = Short.valueOf(items[j - 1]);
- }
- String remark = items[j++].trim();
-
- Book book = new Book();
- book.setBookTitle(bookTitle);
- book.setIsbn(isbn);
- book.setDateOfPrinting(dataOfPringting);
- book.setAuthor(author);
- book.setPress(press);
- book.setCategory(category);
- book.setUnitPrice(unitPrice);
-
- OrderBook orderBook = new OrderBook();
- orderBook.setIsbn(isbn);
- orderBook.setBookTitle(bookTitle);
- orderBook.setStaffId(staffId);
- orderBook.setRemark(remark);
- orderBook.setSecId(secId);
- orderBook.setApproval(false);
-
- orderBookDao.add(orderBook);
- if (bookDao.find(bookTitle, isbn) == null)
- bookDao.add(book);
-
- }
- }
-
- }
-
- @Override
- public List findAddedBookInfoList(String staffId) {
- return orderBookDao.findAddedBookInfoList(staffId);
- }
-
- @Transactional
- @Override
- public void update(ChangedItems changedItems, String staffId) {
- boolean usedByOtherSec = false;
- int secId = changedItems.getSecID();
- List alterItemList = changedItems.getAlterItemList();
-
-
- String bookTitle;
- String isbn;
- Iterator iterator = alterItemList.iterator();
- while (iterator.hasNext()) {
- ChangedItems.AlterItem alterItem = (ChangedItems.AlterItem) iterator.next();
-
- bookTitle = alterItem.getBookTitle();
- isbn = alterItem.getIsbn();
-
- if (orderBookDao.usedByOtherSec(bookTitle, isbn, secId) == 1) {
- usedByOtherSec = true;
- }
-
- String newBookTitle = alterItem.getNewBookTitle();
- String newIsbn = alterItem.getNewIsbn();
- String newDateOfPrinting = alterItem.getNewDateOfPrinting();
- String newAuthor = alterItem.getNewAuthor();
- String newPress = alterItem.getNewPress();
- String newCategory = alterItem.getNewCategory();
- String temp = alterItem.getNewUnitPrice();
- String newRemark = alterItem.getNewRemark();
- short newUnitPrice = 0;
-
- if (!temp.equals("")) {
- newUnitPrice = Short.valueOf(temp);
- }
- Book book = new Book();
- book.setBookTitle(newBookTitle);
- book.setIsbn(newIsbn);
- book.setDateOfPrinting(newDateOfPrinting);
- book.setAuthor(newAuthor);
- book.setPress(newPress);
- book.setCategory(newCategory);
- book.setUnitPrice(newUnitPrice);
- if (!usedByOtherSec)
- bookDao.delete(bookTitle, isbn);
- //TODO 以下代码写的很垃圾,用来判断图书存在
- if (bookDao.find(newBookTitle, newIsbn) == null)
- bookDao.add(book);
- orderBookDao.delete(secId, bookTitle, isbn);
- OrderBook orderBook = new OrderBook();
- orderBook.setSecId(secId);
- orderBook.setStaffId(staffId);
- orderBook.setIsbn(newIsbn);
- orderBook.setBookTitle(newBookTitle);
- orderBook.setRemark(newRemark);
- orderBookDao.add(orderBook);
-
- }
- List deleteItemList = changedItems.getDeleteItemList();
- iterator = deleteItemList.iterator();
- while (iterator.hasNext()) {
- ChangedItems.DeleteItem deleteItem = (ChangedItems.DeleteItem) iterator.next();
- isbn = deleteItem.getIsbn();
- bookTitle = deleteItem.getBookTitle();
-
- orderBookDao.delete(secId, bookTitle, isbn);
- if (!usedByOtherSec)
- bookDao.delete(bookTitle, isbn);
- }
-
- }
-
- @Override
- public void audit(List orderBookReviewVoList) {
- Iterator iterator = orderBookReviewVoList.iterator();
- while (iterator.hasNext()) {
- OrderBookReviewVo orderBookReviewVo = (OrderBookReviewVo) iterator.next();
- int secId = orderBookReviewVo.getSecId();
- String bookTitle = orderBookReviewVo.getBookTitle();
- String isbn = orderBookReviewVo.getIsbn();
- orderBookDao.audit(secId, bookTitle, isbn);
- }
- }
-
- @Override
- public List findAllNotReviewedBook() {
- List orderBookReviewVoList = orderBookDao.findAllNotReviewedBook();
- Iterator iterator = orderBookReviewVoList.iterator();
- while (iterator.hasNext()) {
- OrderBookReviewVo temp = (OrderBookReviewVo) iterator.next();
- int secId = temp.getSecId();
- int stdCount = takesDao.getStdCountInSection(secId);
- temp.setStdCount(stdCount);
- }
-
- return orderBookReviewVoList;
- }
-
-}
diff --git a/src/main/java/com/giit/www/college/service/impl/SectionBizImpl.java b/src/main/java/com/giit/www/college/service/impl/SectionBizImpl.java
deleted file mode 100644
index 1b0bb9d..0000000
--- a/src/main/java/com/giit/www/college/service/impl/SectionBizImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.giit.www.college.service.impl;
-
-import com.giit.www.college.dao.CourseDao;
-import com.giit.www.college.dao.SectionDao;
-import com.giit.www.college.dao.StaffDao;
-import com.giit.www.college.dao.TimetableDao;
-import com.giit.www.college.service.SectionBiz;
-import com.giit.www.entity.Section;
-import com.giit.www.entity.Staff;
-import com.giit.www.entity.Timetable;
-import com.giit.www.entity.custom.SectionCustom;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpSession;
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-12.
- */
-@Service
-public class SectionBizImpl implements SectionBiz {
-
- @Resource
- private SectionDao sectionDao;
- @Resource
- private CourseDao courseDao;
- @Resource
- private StaffDao staffDao;
-
- @Resource
- private TimetableDao timetableDao;
-
- @Transactional
- @Override
- public void delete(int secId) {
- sectionDao.delete(secId);
- timetableDao.delete(secId);
- }
-
- @Override
- public void add(Section section) {
- sectionDao.add(section);
-
- }
-
- @Override
- public List findAllCustom() {
- return sectionDao.findAllCustom();
- }
-
- @Override
- public List findAllCourseTitle() {
- return courseDao.findAllCourseTitle();
- }
-
-
- @Override
- public List findAllStaff() {
- return staffDao.findAll();
- }
-
- @Override
- public void addTimetable(Timetable timetable) {
- timetableDao.add(timetable);
- }
-
-
-}
diff --git a/src/main/java/com/giit/www/college/service/impl/SpecBizImpl.java b/src/main/java/com/giit/www/college/service/impl/SpecBizImpl.java
deleted file mode 100644
index cffd4e9..0000000
--- a/src/main/java/com/giit/www/college/service/impl/SpecBizImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.giit.www.college.service.impl;
-
-import com.giit.www.college.dao.DeptDao;
-import com.giit.www.college.dao.SpecDao;
-import com.giit.www.college.service.SpecBiz;
-import com.giit.www.entity.custom.DeptAndSpec;
-import com.giit.www.entity.Spec;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-11.
- */
-@Service
-public class SpecBizImpl implements SpecBiz {
-
- @Resource
- private SpecDao specDao;
-
- @Resource
- private DeptDao deptDao;
-
- public List findDeptAndSpec() {
- return specDao.findDeptAndSpec();
- }
-
- @Override
- public void update(String specName, String newSpecName) {
- specDao.update(specName, newSpecName);
- }
-
- @Override
- public void add(Spec spec) {
- specDao.add(spec);
- }
-
- @Override
- public void delete(String specName) {
- specDao.delete(specName);
- }
-
- @Override
- public List findDpet() {
- return deptDao.findAllDeptName();
- }
-}
diff --git a/src/main/java/com/giit/www/college/service/impl/StudentBizImpl.java b/src/main/java/com/giit/www/college/service/impl/StudentBizImpl.java
deleted file mode 100644
index 9ab5fba..0000000
--- a/src/main/java/com/giit/www/college/service/impl/StudentBizImpl.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.giit.www.college.service.impl;
-
-import com.giit.www.college.dao.StudentDao;
-import com.giit.www.college.service.StudentBiz;
-import com.giit.www.entity.Student;
-import com.giit.www.entity.User;
-import com.giit.www.system.dao.RoleDao;
-import com.giit.www.system.service.UserBiz;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.annotation.Resource;
-import java.beans.Transient;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Created by c0de8ug on 16-2-13.
- */
-@Service
-public class StudentBizImpl implements StudentBiz {
- @Resource
- private StudentDao studentDao;
-
- @Resource
- private RoleDao roleDao;
-
- @Resource(name = "userBizImpl")
- private UserBiz userBiz;
-
- public List studentView() {
- return studentDao.findAll();
- }
-
- @Transactional
- public void add(Student student, MultipartFile pic) throws IOException {
-
- if (pic.getSize() != 0) {
- String originalFilename = pic.getOriginalFilename();
-
- String fileType = originalFilename.substring(originalFilename.lastIndexOf("."));
- String newFilename = UUID.randomUUID() + fileType;
-
- //TODO 这里的路径分配应该放到环境变量
- String path = "/home/c0de8ug/software/apache-tomcat-8.0.28/pic/";
-
- File dest = new File(path + newFilename);
- pic.transferTo(dest);
-
- student.setPicPath(newFilename);
- }
-
- studentDao.add(student);
-
- //TODO 这里学生的学号是临时用的,写的很垃圾,以后改成username 和自动生成的id主键进行关联,学号使用班级号+人数生成
- User user = new User();
- user.setUserId(student.getStudentId());
- Long roleId = roleDao.findByDescription("学生").getId();
- List tempList = new ArrayList<>();
- tempList.add(roleId);
- user.setRoleIds(tempList);
- user.setLocked(false);
- user.setPassword(student.getPassword());
- userBiz.add(user);
- }
-
- @Override
- public void update(Student student) {
- studentDao.update(student);
- }
-
- //TODO 应该连带删除掉student和staff
- @Transactional
- @Override
- public void delete(int studentId) {
- studentDao.delete(studentId);
- }
-
-}
diff --git a/src/main/java/com/giit/www/entity/Book.java b/src/main/java/com/giit/www/entity/Book.java
deleted file mode 100644
index 690c9e7..0000000
--- a/src/main/java/com/giit/www/entity/Book.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.giit.www.entity;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public class Book {
-
- String bookTitle;
- String isbn;
- String dateOfPrinting;
- String author;
- String press;
- String category;
- Short unitPrice;
-
- public String getBookTitle() {
- return bookTitle;
- }
-
- public void setBookTitle(String bookTitle) {
- this.bookTitle = bookTitle;
- }
-
- public String getIsbn() {
- return isbn;
- }
-
- public void setIsbn(String isbn) {
- this.isbn = isbn;
- }
-
- public String getDateOfPrinting() {
- return dateOfPrinting;
- }
-
- public void setDateOfPrinting(String dateOfPrinting) {
- this.dateOfPrinting = dateOfPrinting;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public String getPress() {
- return press;
- }
-
- public void setPress(String press) {
- this.press = press;
- }
-
- public String getCategory() {
- return category;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
- public Short getUnitPrice() {
- return unitPrice;
- }
-
- public void setUnitPrice(Short unitPrice) {
- this.unitPrice = unitPrice;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/Clazz.java b/src/main/java/com/giit/www/entity/Clazz.java
deleted file mode 100644
index c763bc9..0000000
--- a/src/main/java/com/giit/www/entity/Clazz.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.giit.www.entity;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public class Clazz {
- String clazzId;
- String className;
- String year;
- String specName;
-
- public String getClazzId() {
- return clazzId;
- }
-
- public void setClazzId(String clazzId) {
- this.clazzId = clazzId;
- }
-
- public String getClassName() {
- return className;
- }
-
- public void setClassName(String className) {
- this.className = className;
- }
-
- public String getYear() {
- return year;
- }
-
- public void setYear(String year) {
- this.year = year;
- }
-
- public String getSpecName() {
- return specName;
- }
-
- public void setSpecName(String specName) {
- this.specName = specName;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/Course.java b/src/main/java/com/giit/www/entity/Course.java
deleted file mode 100644
index 7d7fdc8..0000000
--- a/src/main/java/com/giit/www/entity/Course.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.giit.www.entity;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public class Course {
- String courseTitle;
- String type;
- String speciality;
- float credits;
-
- public String getCourseTitle() {
- return courseTitle;
- }
-
- public void setCourseTitle(String courseTitle) {
- this.courseTitle = courseTitle;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getSpeciality() {
- return speciality;
- }
-
- public void setSpeciality(String speciality) {
- this.speciality = speciality;
- }
-
- public float getCredits() {
- return credits;
- }
-
- public void setCredits(float credits) {
- this.credits = credits;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/Dept.java b/src/main/java/com/giit/www/entity/Dept.java
deleted file mode 100644
index 7c34a49..0000000
--- a/src/main/java/com/giit/www/entity/Dept.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.giit.www.entity;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public class Dept {
- int deptId;
- String deptName;
-
- public int getDeptId() {
- return deptId;
- }
-
- public void setDeptId(int deptId) {
- this.deptId = deptId;
- }
-
- public String getDeptName() {
- return deptName;
- }
-
- public void setDeptName(String deptName) {
- this.deptName = deptName;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/OrderBook.java b/src/main/java/com/giit/www/entity/OrderBook.java
deleted file mode 100644
index 4580f3e..0000000
--- a/src/main/java/com/giit/www/entity/OrderBook.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.giit.www.entity;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public class OrderBook {
- String staffId;
- String bookTitle;
- String isbn;
- String remark;
- int secId;
- boolean approval;
-
- public String getStaffId() {
- return staffId;
- }
-
- public void setStaffId(String staffId) {
- this.staffId = staffId;
- }
-
- public String getBookTitle() {
- return bookTitle;
- }
-
- public void setBookTitle(String bookTitle) {
- this.bookTitle = bookTitle;
- }
-
- public String getIsbn() {
- return isbn;
- }
-
- public void setIsbn(String isbn) {
- this.isbn = isbn;
- }
-
- public String getRemark() {
- return remark;
- }
-
- public void setRemark(String remark) {
- this.remark = remark;
- }
-
- public int getSecId() {
- return secId;
- }
-
- public void setSecId(int secId) {
- this.secId = secId;
- }
-
- public boolean isApproval() {
- return approval;
- }
-
- public void setApproval(boolean approval) {
- this.approval = approval;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/Section.java b/src/main/java/com/giit/www/entity/Section.java
deleted file mode 100644
index e8dc1f0..0000000
--- a/src/main/java/com/giit/www/entity/Section.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.giit.www.entity;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public class Section {
- int secId;
- String courseTitle;
- String year;
- String staffId;
-
- public int getSecId() {
- return secId;
- }
-
- public void setSecId(int secId) {
- this.secId = secId;
- }
-
- public String getCourseTitle() {
- return courseTitle;
- }
-
- public void setCourseTitle(String courseTitle) {
- this.courseTitle = courseTitle;
- }
-
- public String getYear() {
- return year;
- }
-
- public void setYear(String year) {
- this.year = year;
- }
-
- public String getStaffId() {
- return staffId;
- }
-
- public void setStaffId(String staffId) {
- this.staffId = staffId;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/Spec.java b/src/main/java/com/giit/www/entity/Spec.java
deleted file mode 100644
index 3730569..0000000
--- a/src/main/java/com/giit/www/entity/Spec.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.giit.www.entity;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public class Spec {
- int specId;
- String deptName;
- String specName;
- String year;
- String semester;
-
- public int getSpecId() {
- return specId;
- }
-
- public void setSpecId(int specId) {
- this.specId = specId;
- }
-
- public String getDeptName() {
- return deptName;
- }
-
- public void setDeptName(String deptName) {
- this.deptName = deptName;
- }
-
- public String getSpecName() {
- return specName;
- }
-
- public void setSpecName(String specName) {
- this.specName = specName;
- }
-
- public String getYear() {
- return year;
- }
-
- public void setYear(String year) {
- this.year = year;
- }
-
- public String getSemester() {
- return semester;
- }
-
- public void setSemester(String semester) {
- this.semester = semester;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/Staff.java b/src/main/java/com/giit/www/entity/Staff.java
deleted file mode 100644
index b6ac452..0000000
--- a/src/main/java/com/giit/www/entity/Staff.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.giit.www.entity;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public class Staff {
- String staffId;
- String staffName;
-
- public String getStaffId() {
- return staffId;
- }
-
- public void setStaffId(String staffId) {
- this.staffId = staffId;
- }
-
- public String getStaffName() {
- return staffName;
- }
-
- public void setStaffName(String staffName) {
- this.staffName = staffName;
- }
-
-}
diff --git a/src/main/java/com/giit/www/entity/Student.java b/src/main/java/com/giit/www/entity/Student.java
deleted file mode 100644
index bb430b7..0000000
--- a/src/main/java/com/giit/www/entity/Student.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package com.giit.www.entity;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public class Student {
- String studentId;
- String password;
- String studentName;
- String idCard;
- String year;
- String className;
- String telephoneNumber;
- String studentOriginBase;
- String gender;
- String picPath;
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getStudentId() {
- return studentId;
- }
-
- public void setStudentId(String studentId) {
- this.studentId = studentId;
- }
-
- public String getStudentName() {
- return studentName;
- }
-
- public void setStudentName(String studentName) {
- this.studentName = studentName;
- }
-
- public String getIdCard() {
- return idCard;
- }
-
- public void setIdCard(String idCard) {
- this.idCard = idCard;
- }
-
- public String getYear() {
- return year;
- }
-
- public void setYear(String year) {
- this.year = year;
- }
-
- public String getClassName() {
- return className;
- }
-
- public void setClassName(String className) {
- this.className = className;
- }
-
- public String getTelephoneNumber() {
- return telephoneNumber;
- }
-
- public void setTelephoneNumber(String telephoneNumber) {
- this.telephoneNumber = telephoneNumber;
- }
-
- public String getStudentOriginBase() {
- return studentOriginBase;
- }
-
- public void setStudentOriginBase(String studentOriginBase) {
- this.studentOriginBase = studentOriginBase;
- }
-
- public String getGender() {
- return gender;
- }
-
- public void setGender(String gender) {
- this.gender = gender;
- }
-
- public String getPicPath() {
- return picPath;
- }
-
- public void setPicPath(String picPath) {
- this.picPath = picPath;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/Takes.java b/src/main/java/com/giit/www/entity/Takes.java
deleted file mode 100644
index 8fef9ec..0000000
--- a/src/main/java/com/giit/www/entity/Takes.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.giit.www.entity;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public class Takes {
- String studentId;
- String secId;
- float score;
-
- public String getStudentId() {
- return studentId;
- }
-
- public void setStudentId(String studentId) {
- this.studentId = studentId;
- }
-
- public String getSecId() {
- return secId;
- }
-
- public void setSecId(String secId) {
- this.secId = secId;
- }
-
- public float getScore() {
- return score;
- }
-
- public void setScore(float score) {
- this.score = score;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/Timetable.java b/src/main/java/com/giit/www/entity/Timetable.java
deleted file mode 100644
index 5e2333c..0000000
--- a/src/main/java/com/giit/www/entity/Timetable.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.giit.www.entity;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public class Timetable {
- int secId;
- String time;
- String weeks;
- String week;
- String classroom;
-
- public int getSecId() {
- return secId;
- }
-
- public void setSecId(int secId) {
- this.secId = secId;
- }
-
- public String getTime() {
- return time;
- }
-
- public void setTime(String time) {
- this.time = time;
- }
-
- public String getWeeks() {
- return weeks;
- }
-
- public void setWeeks(String weeks) {
- this.weeks = weeks;
- }
-
- public String getWeek() {
- return week;
- }
-
- public void setWeek(String week) {
- this.week = week;
- }
-
- public String getClassroom() {
- return classroom;
- }
-
- public void setClassroom(String classroom) {
- this.classroom = classroom;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/custom/AddedBookVo.java b/src/main/java/com/giit/www/entity/custom/AddedBookVo.java
deleted file mode 100644
index 3974a34..0000000
--- a/src/main/java/com/giit/www/entity/custom/AddedBookVo.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.giit.www.entity.custom;
-
-import com.giit.www.entity.Section;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-15.
- */
-
-//TODO命名风格有问题
-public class AddedBookVo {
- String secId;
- String courseTitle;
-
- public String getCourseTitle() {
- return courseTitle;
- }
-
- public void setCourseTitle(String courseTitle) {
- this.courseTitle = courseTitle;
- }
-
- List bookInfoList;
-
- public String getSecId() {
- return secId;
- }
-
- public void setSecId(String secId) {
- this.secId = secId;
- }
-
- public List getBookInfoList() {
- return bookInfoList;
- }
-
- public void setBookInfoList(List bookInfoList) {
- this.bookInfoList = bookInfoList;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/custom/BookInfo.java b/src/main/java/com/giit/www/entity/custom/BookInfo.java
deleted file mode 100644
index c6cacdf..0000000
--- a/src/main/java/com/giit/www/entity/custom/BookInfo.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.giit.www.entity.custom;
-
-import com.giit.www.entity.Book;
-
-/**
- * Created by c0de8ug on 16-2-15.
- */
-public class BookInfo extends Book {
- String remark;
-
- public String getRemark() {
- return remark;
- }
-
- public void setRemark(String remark) {
- this.remark = remark;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/custom/ChangedItems.java b/src/main/java/com/giit/www/entity/custom/ChangedItems.java
deleted file mode 100644
index 3f81d0f..0000000
--- a/src/main/java/com/giit/www/entity/custom/ChangedItems.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package com.giit.www.entity.custom;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-15.
- */
-public class ChangedItems {
- int secId;
-
- public int getSecID() {
- return secId;
- }
-
- public void setSecID(int secId) {
- this.secId = secId;
- }
-
- public List getAlterItemList() {
- return alterItemList;
- }
-
- public void setAlterItemList(List alterItemList) {
- this.alterItemList = alterItemList;
- }
-
- public List getDeleteItemList() {
- return deleteItemList;
- }
-
- public void setDeleteItemList(List deleteItemList) {
- this.deleteItemList = deleteItemList;
- }
-
- List alterItemList;
-
-
- List deleteItemList;
-
- public static class AlterItem {
- public String getBookTitle() {
- return bookTitle;
- }
-
- public void setBookTitle(String bookTitle) {
- this.bookTitle = bookTitle;
- }
-
- public String getIsbn() {
- return isbn;
- }
-
- public void setIsbn(String isbn) {
- this.isbn = isbn;
- }
-
- public String getNewBookTitle() {
- return newBookTitle;
- }
-
- public void setNewBookTitle(String newBookTitle) {
- this.newBookTitle = newBookTitle;
- }
-
- public String getNewIsbn() {
- return newIsbn;
- }
-
- public void setNewIsbn(String newIsbn) {
- this.newIsbn = newIsbn;
- }
-
- public String getNewDateOfPrinting() {
- return newDateOfPrinting;
- }
-
- public void setNewDateOfPrinting(String newDateOfPrinting) {
- this.newDateOfPrinting = newDateOfPrinting;
- }
-
- public String getNewAuthor() {
- return newAuthor;
- }
-
- public void setNewAuthor(String newAuthor) {
- this.newAuthor = newAuthor;
- }
-
- public String getNewPress() {
- return newPress;
- }
-
- public void setNewPress(String newPress) {
- this.newPress = newPress;
- }
-
- public String getNewCategory() {
- return newCategory;
- }
-
- public void setNewCategory(String newCategory) {
- this.newCategory = newCategory;
- }
-
- public String getNewUnitPrice() {
- return newUnitPrice;
- }
-
- public void setNewUnitPrice(String newUnitPrice) {
- this.newUnitPrice = newUnitPrice;
- }
-
- public String getNewRemark() {
- return newRemark;
- }
-
- public void setNewRemark(String newRemark) {
- this.newRemark = newRemark;
- }
-
- String bookTitle;
- String isbn;
- String newBookTitle;
- String newIsbn;
- String newDateOfPrinting;
- String newAuthor;
- String newPress;
- String newCategory;
- String newUnitPrice;
- String newRemark;
- }
-
- public static class DeleteItem {
- public String getBookTitle() {
- return bookTitle;
- }
-
- public void setBookTitle(String bookTitle) {
- this.bookTitle = bookTitle;
- }
-
- public String getIsbn() {
- return isbn;
- }
-
- public void setIsbn(String isbn) {
- this.isbn = isbn;
- }
-
- String bookTitle;
- String isbn;
- }
-
-
-}
diff --git a/src/main/java/com/giit/www/entity/custom/DeptAndSpec.java b/src/main/java/com/giit/www/entity/custom/DeptAndSpec.java
deleted file mode 100644
index 23ed5c9..0000000
--- a/src/main/java/com/giit/www/entity/custom/DeptAndSpec.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.giit.www.entity.custom;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-11.
- */
-public class DeptAndSpec {
- String deptName;
- List specName;
-
- public String getDeptName() {
- return deptName;
- }
-
- public void setDeptName(String deptName) {
- this.deptName = deptName;
- }
-
- public List getSpecName() {
- return specName;
- }
-
- public void setSpecName(List specName) {
- this.specName = specName;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/custom/OrderBookReviewVo.java b/src/main/java/com/giit/www/entity/custom/OrderBookReviewVo.java
deleted file mode 100644
index acffdd0..0000000
--- a/src/main/java/com/giit/www/entity/custom/OrderBookReviewVo.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package com.giit.www.entity.custom;
-
-/**
- * Created by c0de8ug on 16-2-16.
- */
-public class OrderBookReviewVo {
- String speciality;
- String courseTitle;
- String bookTitle;
- String isbn;
- String dateOfPrinting;
- String author;
- String category;
- float unitPrice;
- String remark;
- String press;
- int stdCount;
- int secId;
-
- public int getSecId() {
- return secId;
- }
-
- public void setSecId(int secId) {
- this.secId = secId;
- }
-
- public int getStdCount() {
- return stdCount;
- }
-
- public void setStdCount(int stdCount) {
- this.stdCount = stdCount;
- }
-
- public String getPress() {
- return press;
- }
-
- public void setPress(String press) {
- this.press = press;
- }
-
- public String getSpeciality() {
- return speciality;
- }
-
- public void setSpeciality(String speciality) {
- this.speciality = speciality;
- }
-
- public String getCourseTitle() {
- return courseTitle;
- }
-
- public void setCourseTitle(String courseTitle) {
- this.courseTitle = courseTitle;
- }
-
- public String getBookTitle() {
- return bookTitle;
- }
-
- public void setBookTitle(String bookTitle) {
- this.bookTitle = bookTitle;
- }
-
- public String getIsbn() {
- return isbn;
- }
-
- public void setIsbn(String isbn) {
- this.isbn = isbn;
- }
-
- public String getDateOfPrinting() {
- return dateOfPrinting;
- }
-
- public void setDateOfPrinting(String dateOfPrinting) {
- this.dateOfPrinting = dateOfPrinting;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public String getCategory() {
- return category;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
- public float getUnitPrice() {
- return unitPrice;
- }
-
- public void setUnitPrice(float unitPrice) {
- this.unitPrice = unitPrice;
- }
-
- public String getRemark() {
- return remark;
- }
-
- public void setRemark(String remark) {
- this.remark = remark;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/custom/OrderBookVo.java b/src/main/java/com/giit/www/entity/custom/OrderBookVo.java
deleted file mode 100644
index 5412c2e..0000000
--- a/src/main/java/com/giit/www/entity/custom/OrderBookVo.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.giit.www.entity.custom;
-
-import java.util.Map;
-
-/**
- * Created by c0de8ug on 16-2-14.
- */
-public class OrderBookVo {
- String staffId;
- Map map;
-
- public String getStaffId() {
- return staffId;
- }
-
- public void setStaffId(String staffId) {
- this.staffId = staffId;
- }
-
- public Map getMap() {
- return map;
- }
-
- public void setMap(Map map) {
- this.map = map;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/custom/ReviewedBookVo.java b/src/main/java/com/giit/www/entity/custom/ReviewedBookVo.java
deleted file mode 100644
index 9b38c50..0000000
--- a/src/main/java/com/giit/www/entity/custom/ReviewedBookVo.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.giit.www.entity.custom;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-16.
- */
-public class ReviewedBookVo {
- String bookTitle;
- String isbn;
- String dateOfPrinting;
- String author;
- String press;
- int count;
-
- public int getCount() {
- return count;
- }
-
- public void setCount(int count) {
- this.count = count;
- }
-
- public String getBookTitle() {
- return bookTitle;
- }
-
- public void setBookTitle(String bookTitle) {
- this.bookTitle = bookTitle;
- }
-
- public String getIsbn() {
- return isbn;
- }
-
- public void setIsbn(String isbn) {
- this.isbn = isbn;
- }
-
- public String getDateOfPrinting() {
- return dateOfPrinting;
- }
-
- public void setDateOfPrinting(String dateOfPrinting) {
- this.dateOfPrinting = dateOfPrinting;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public String getPress() {
- return press;
- }
-
- public void setPress(String press) {
- this.press = press;
- }
-
-
-}
diff --git a/src/main/java/com/giit/www/entity/custom/SectionCustom.java b/src/main/java/com/giit/www/entity/custom/SectionCustom.java
deleted file mode 100644
index a6b70ee..0000000
--- a/src/main/java/com/giit/www/entity/custom/SectionCustom.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.giit.www.entity.custom;
-
-import com.giit.www.entity.Section;
-import com.giit.www.entity.Timetable;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-12.
- */
-//TODO 对于这些满足业务需求的pojo自定义名字定义感觉不太会
-public class SectionCustom extends Section {
- String teacher;
- List timetableList;
-
- public String getTeacher() {
- return teacher;
- }
-
- public void setTeacher(String teacher) {
- this.teacher = teacher;
- }
-
- public List getTimetableList() {
- return timetableList;
- }
-
- public void setTimetableList(List timetableList) {
- this.timetableList = timetableList;
- }
-}
diff --git a/src/main/java/com/giit/www/entity/custom/UserVo.java b/src/main/java/com/giit/www/entity/custom/UserVo.java
deleted file mode 100644
index a2eaf88..0000000
--- a/src/main/java/com/giit/www/entity/custom/UserVo.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.giit.www.entity.custom;
-
-import com.giit.www.entity.User;
-
-/**
- * Created by c0de8ug on 16-2-21.
- */
-public class UserVo extends User {
- String roleIdsStr;
-
- @Override
- public String getRoleIdsStr() {
- return roleIdsStr;
- }
-
- @Override
- public void setRoleIdsStr(String roleIdsStr) {
- this.roleIdsStr = roleIdsStr;
- }
-}
diff --git a/src/main/java/com/giit/www/student/controller/ElectiveController.java b/src/main/java/com/giit/www/student/controller/ElectiveController.java
deleted file mode 100644
index e696bec..0000000
--- a/src/main/java/com/giit/www/student/controller/ElectiveController.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.giit.www.student.controller;
-
-import com.giit.www.student.service.ElectiveBiz;
-import org.apache.shiro.authz.annotation.Logical;
-import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpSession;
-
-/**
- * Created by c0de8ug on 16-2-16.
- */
-@Controller
-
-@RequestMapping("elective.do")
-public class ElectiveController {
- @Resource(name = "electiveBizImpl")
- private ElectiveBiz electiveBiz;
-
- @RequiresRoles(value = {"admin", "student"}, logical = Logical.OR)
- @RequestMapping("elective.view")
- public String electiveView(Model m) {
- m.addAttribute("sectionList", electiveBiz.findAllSection());
- return "/student/elective";
- }
-
- @RequiresRoles(value = {"admin", "student"}, logical = Logical.OR)
- @RequestMapping("add")
- public String add(int secId, HttpSession session) {
- String stdId = (String) session.getAttribute("username");
- electiveBiz.add(secId, stdId);
- return "redirect:/elective.do/elective.view";
- }
-
- @RequiresRoles(value = {"admin", "student"}, logical = Logical.OR)
- @RequestMapping("delete")
- public String delete(int secId, HttpSession session) {
- String stdId = (String) session.getAttribute("username");
- electiveBiz.delete(secId, stdId);
- return "redirect:/elective.do/elective.view";
- }
-
-}
diff --git a/src/main/java/com/giit/www/student/service/ElectiveBiz.java b/src/main/java/com/giit/www/student/service/ElectiveBiz.java
deleted file mode 100644
index 3a83643..0000000
--- a/src/main/java/com/giit/www/student/service/ElectiveBiz.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.giit.www.student.service;
-
-import com.giit.www.entity.Section;
-import com.giit.www.entity.custom.SectionCustom;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-16.
- */
-public interface ElectiveBiz {
- public void add(int secId, String stdId);
-
- public List findAllSection();
-
- public void delete(int secId, String stdId);
-}
diff --git a/src/main/java/com/giit/www/student/service/Impl/ElectiveBizImpl.java b/src/main/java/com/giit/www/student/service/Impl/ElectiveBizImpl.java
deleted file mode 100644
index ad63e6e..0000000
--- a/src/main/java/com/giit/www/student/service/Impl/ElectiveBizImpl.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.giit.www.student.service.Impl;
-
-import com.giit.www.college.dao.SectionDao;
-import com.giit.www.college.dao.TakesDao;
-import com.giit.www.entity.Section;
-import com.giit.www.entity.custom.SectionCustom;
-import com.giit.www.student.service.ElectiveBiz;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-16.
- */
-@Service
-public class ElectiveBizImpl implements ElectiveBiz {
-
- @Resource
- private TakesDao takesDao;
-
- @Resource
- private SectionDao sectionDao;
-
- public void add(int secId, String stdId) {
- takesDao.add(secId, stdId);
- }
-
- @Override
- public List findAllSection() {
- return sectionDao.findAllCustom();
- }
-
- @Override
- public void delete(int secId, String stdId) {
- takesDao.delete(secId,stdId);
- }
-}
diff --git a/src/main/java/com/giit/www/supplier/controller/SupplierController.java b/src/main/java/com/giit/www/supplier/controller/SupplierController.java
deleted file mode 100644
index ab532bf..0000000
--- a/src/main/java/com/giit/www/supplier/controller/SupplierController.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.giit.www.supplier.controller;
-
-import com.giit.www.supplier.service.SupplierBiz;
-import org.apache.shiro.authz.annotation.Logical;
-import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import javax.annotation.Resource;
-
-/**
- * Created by c0de8ug on 16-2-16.
- */
-
-@Controller
-
-@RequestMapping("supplier.do")
-public class SupplierController {
-
- @Resource(name = "supplierBizImpl")
- SupplierBiz supplierBiz;
-
- @RequiresRoles(value = {"admin", "supplier"}, logical = Logical.OR)
- @RequestMapping("supplier.view")
- public String supplierView(Model m) {
- m.addAttribute("reviewedBookList", supplierBiz.findAllReviewedBook());
- return "/supplier/supplier";
- }
-}
diff --git a/src/main/java/com/giit/www/supplier/service/SupplierBiz.java b/src/main/java/com/giit/www/supplier/service/SupplierBiz.java
deleted file mode 100644
index a1a87ab..0000000
--- a/src/main/java/com/giit/www/supplier/service/SupplierBiz.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.giit.www.supplier.service;
-
-import com.giit.www.entity.custom.ReviewedBookVo;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-16.
- */
-public interface SupplierBiz {
- public List findAllReviewedBook();
-}
diff --git a/src/main/java/com/giit/www/supplier/service/impl/SupplierBizImpl.java b/src/main/java/com/giit/www/supplier/service/impl/SupplierBizImpl.java
deleted file mode 100644
index 093a9fa..0000000
--- a/src/main/java/com/giit/www/supplier/service/impl/SupplierBizImpl.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.giit.www.supplier.service.impl;
-
-import com.giit.www.college.dao.OrderBookDao;
-import com.giit.www.college.dao.TakesDao;
-import com.giit.www.entity.custom.OrderBookReviewVo;
-import com.giit.www.entity.custom.OrderBookVo;
-import com.giit.www.entity.custom.ReviewedBookVo;
-import com.giit.www.supplier.service.SupplierBiz;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-16.
- */
-@Service
-public class SupplierBizImpl implements SupplierBiz {
-
- @Resource
- private OrderBookDao orderBookDao;
-
-
- //TODO 这个代码偷懒了!!!!!要多烂有多烂直接拷贝的。。
- public List findAllReviewedBook() {
- List reviewedBookVoList = orderBookDao.findAllReviewedBook();
- return reviewedBookVoList;
- }
-
-}
diff --git a/src/main/java/com/giit/www/system/controller/MainController.java b/src/main/java/com/giit/www/system/controller/MainController.java
deleted file mode 100644
index b563e39..0000000
--- a/src/main/java/com/giit/www/system/controller/MainController.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.giit.www.system.controller;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-/**
- * Created by c0de8ug on 16-2-16.
- */
-
-//TODO 由于放在WEB-INF所以在对主页跳转不能直接链接访问,等程序写多后要善于总结比较后改正,这样写太坑
-@Controller
-@RequestMapping("main.do")
-public class MainController {
-
- @RequestMapping("admin")
- public String adminMainView() {
- return "/admin/main";
- }
-
- @RequestMapping("student")
- public String studentMainView() {
- return "/student/main";
- }
-
- @RequestMapping("teacher")
- public String teacherMainView() {
- return "/teacher/main";
- }
-}
diff --git a/src/main/java/com/giit/www/system/controller/RoleController.java b/src/main/java/com/giit/www/system/controller/RoleController.java
deleted file mode 100644
index c128185..0000000
--- a/src/main/java/com/giit/www/system/controller/RoleController.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package com.giit.www.system.controller;
-
-import com.giit.www.entity.Role;
-import com.giit.www.system.dao.RoleDao;
-import com.giit.www.system.service.ResourceBiz;
-import com.giit.www.system.service.RoleBiz;
-import com.giit.www.system.service.impl.RoleBizImpl;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.servlet.mvc.support.RedirectAttributes;
-
-import javax.annotation.Resource;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Created by c0de8ug on 16-2-21.
- */
-@Controller
-
-@RequestMapping("/role.do")
-public class RoleController {
-
-
- @Resource(name = "roleBizImpl")
- private RoleBiz roleBiz;
-
- @Resource(name = "resourceBizImpl")
- private ResourceBiz resourceBiz;
-
- @RequiresRoles("admin")
- @RequestMapping("role.view")
- public String roleView(Model model) {
- model.addAttribute("roleList", roleBiz.findAll());
- return "/admin/system/role/role";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("role_add.view")
- public String roleAddView(Model model) {
- model.addAttribute("roleList", roleBiz.findAll());
- return "/admin/system/role/role_add";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("add")
- public String add(Role role, RedirectAttributes redirectAttributes) {
- roleBiz.createRole(role);
- return "redirect:/role.do/role.view";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("delete")
- public String delete(Long id, RedirectAttributes redirectAttributes) {
- roleBiz.deleteRole(id);
- return "redirect:/role.do/role.view";
- }
-
-//
-// @RequiresPermissions("role:create")
-// @RequestMapping(value = "/create", method = RequestMethod.GET)
-// public String showCreateForm(Model model) {
-// setCommonData(model);
-// model.addAttribute("role", new Role());
-// model.addAttribute("op", "新增");
-// return "role/edit";
-// }
-//
-// @RequiresPermissions("role:update")
-// @RequestMapping(value = "/{id}/update", method = RequestMethod.GET)
-// public String showUpdateForm(@PathVariable("id") Long id, Model model) {
-// setCommonData(model);
-// model.addAttribute("role", roleBiz.findOne(id));
-// model.addAttribute("op", "修改");
-// return "role/edit";
-// }
-//
-// @RequiresPermissions("role:update")
-// @RequestMapping(value = "/{id}/update", method = RequestMethod.POST)
-// public String update(Role role, RedirectAttributes redirectAttributes) {
-// roleBiz.updateRole(role);
-// redirectAttributes.addFlashAttribute("msg", "修改成功");
-// return "redirect:/role";
-// }
-//
-// @RequiresPermissions("role:delete")
-// @RequestMapping(value = "/{id}/delete", method = RequestMethod.GET)
-// public String showDeleteForm(@PathVariable("id") Long id, Model model) {
-// setCommonData(model);
-// model.addAttribute("role", roleBiz.findOne(id));
-// model.addAttribute("op", "删除");
-// return "role/edit";
-// }
-
-
-// private void setCommonData(Model model) {
-// model.addAttribute("resourceList", roleBiz.findAll());
-// }
-
-
-}
diff --git a/src/main/java/com/giit/www/system/controller/UserController.java b/src/main/java/com/giit/www/system/controller/UserController.java
deleted file mode 100644
index b70a315..0000000
--- a/src/main/java/com/giit/www/system/controller/UserController.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.giit.www.system.controller;
-
-import com.giit.www.entity.User;
-import com.giit.www.system.service.RoleBiz;
-import com.giit.www.system.service.UserBiz;
-import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-
-@Controller
-@RequiresRoles("admin")
-@RequestMapping("user.do")
-public class UserController {
-
- @Resource(name = "userBizImpl")
- private UserBiz userBiz;
-
- @Resource(name = "roleBizImpl")
- private RoleBiz roleBiz;
-
- @RequiresRoles("admin")
- @RequestMapping("user.view")
- public String userView(Model m) throws InvocationTargetException, IllegalAccessException {
- m.addAttribute("userList", userBiz.findAll());
- return "/admin/system/user/user";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("user_add.view")
- public String userAddView(Model m) {
- m.addAttribute("roleList", roleBiz.findAll());
- return "/admin/system/user/user_add";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("findById")
- public String findById(String id, Model m) {
- //todo 这里要做非空判断
- m.addAttribute("user", userBiz.findById(id));
- return "/admin/system/user/user_update";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("update")
- public String update(User user) {
- userBiz.update(user);
- return "redirect:/user.do/user.view";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("add")
- public String add(User user) {
-
- userBiz.add(user);
- return "redirect:/user.do/user.view";
- }
-
- @RequiresRoles("admin")
- @RequestMapping("delete")
- public String delete(String id) {
- userBiz.delete(id);
- return "redirect:/user.do/user.view";
- }
-
-}
diff --git a/src/main/java/com/giit/www/system/dao/ResourceDao.java b/src/main/java/com/giit/www/system/dao/ResourceDao.java
deleted file mode 100644
index 26b4eef..0000000
--- a/src/main/java/com/giit/www/system/dao/ResourceDao.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.giit.www.system.dao;
-
-
-import com.giit.www.entity.Resource;
-
-import java.util.List;
-
-/**
- * Resource: Zhang Kaitao
- *
Date: 14-1-28
- *
Version: 1.0
- */
-public interface ResourceDao {
-
- public Resource createResource(Resource resource);
-
- public Resource updateResource(Resource resource);
-
- public void deleteResource(Long resourceId);
-
- Resource findOne(Long resourceId);
-
- List findAll();
-
-}
diff --git a/src/main/java/com/giit/www/system/dao/ResourceDao.xml b/src/main/java/com/giit/www/system/dao/ResourceDao.xml
deleted file mode 100644
index 466a480..0000000
--- a/src/main/java/com/giit/www/system/dao/ResourceDao.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/java/com/giit/www/system/interceptor/LoginIntercepter.java b/src/main/java/com/giit/www/system/interceptor/LoginIntercepter.java
deleted file mode 100644
index d9bbec5..0000000
--- a/src/main/java/com/giit/www/system/interceptor/LoginIntercepter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.giit.www.system.interceptor;
-
-
-import org.springframework.web.servlet.HandlerInterceptor;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-/**
- * Created by c0de8ug on 16-2-14.
- */
-public class LoginIntercepter implements HandlerInterceptor {
-
- @Override
- public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
-
- String url = httpServletRequest.getRequestURI();
-
- if (url.indexOf("login") > 0) {
- return true;
- }
-
- HttpSession session = httpServletRequest.getSession();
- String username = (String) session.getAttribute("username");
- if (username != null) {
- return true;
- }
-
- httpServletResponse.sendRedirect(httpServletRequest.getContextPath() + "/login.jsp");
- return false;
- }
-
- @Override
- public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
-//
-//
-// String redirectStr = "redirect:";
-// int strLength = 9;
-//
-//
-// String path = modelAndView.getViewName();
-// if (path.indexOf(redirectStr) == 0) {
-// String temp = path.substring(strLength);
-//
-// modelAndView.setViewName(redirectStr + contextPath + temp);
-// }
- }
-
- @Override
- public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
-
- }
-}
diff --git a/src/main/java/com/giit/www/system/service/impl/AccountBizImpl.java b/src/main/java/com/giit/www/system/service/impl/AccountBizImpl.java
deleted file mode 100644
index 728cd83..0000000
--- a/src/main/java/com/giit/www/system/service/impl/AccountBizImpl.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.giit.www.system.service.impl;
-
-import com.giit.www.entity.User;
-import com.giit.www.system.dao.UserDao;
-import com.giit.www.system.service.AccountBiz;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-
-/**
- * Created by c0de8ug on 16-2-14.
- */
-@Service
-public class AccountBizImpl implements AccountBiz {
-
- @Resource
- UserDao userDao;
-
- @Override
- public User findByIdAndPassword(String username, String password) {
- return userDao.findByIdAndPassword(username, password);
- }
-
-
- @Override
- public void updatePassword(String id, String password) {
- userDao.updatePassword(id, password);
- }
-}
diff --git a/src/main/java/com/giit/www/system/service/impl/UserBizImpl.java b/src/main/java/com/giit/www/system/service/impl/UserBizImpl.java
deleted file mode 100644
index 8d85c4f..0000000
--- a/src/main/java/com/giit/www/system/service/impl/UserBizImpl.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package com.giit.www.system.service.impl;
-
-import com.giit.www.college.dao.StaffDao;
-import com.giit.www.entity.Role;
-import com.giit.www.entity.Staff;
-import com.giit.www.entity.User;
-import com.giit.www.entity.custom.UserVo;
-import com.giit.www.system.dao.RoleDao;
-import com.giit.www.system.dao.UserDao;
-import com.giit.www.system.service.RoleBiz;
-import com.giit.www.system.service.UserBiz;
-import com.giit.www.util.PasswordHelper;
-import org.apache.commons.beanutils.BeanUtils;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-
-@Service
-public class UserBizImpl implements UserBiz {
-
- @Resource
- UserDao userDao;
-
- @Resource
- RoleDao roleDao;
-
- @Resource
- StaffDao staffDao;
-
- @Resource
- private PasswordHelper passwordHelper;
- @Resource(name = "roleBizImpl")
- private RoleBiz roleBiz;
-
- @Override
- public List findAll() throws InvocationTargetException, IllegalAccessException {
- List userVoList = new ArrayList<>();
- List userList = userDao.findAll();
-
-
- Iterator iterator = userList.iterator();
-
- while (iterator.hasNext()) {
- StringBuilder s = new StringBuilder();
- User user = (User) iterator.next();
- List roleIds = user.getRoleIds();
-
- UserVo userVo = new UserVo();
- BeanUtils.copyProperties(userVo, user);
-
- if (roleIds != null) {
- int i = 0;
- int size = roleIds.size();
- for (; i < size - 1; i++) {
- Role role = roleDao.findOne(roleIds.get(i));
-
- s.append(role.getDescription());
- s.append(",");
- }
- Role role = roleDao.findOne(roleIds.get(i));
- s.append(role.getDescription());
- userVo.setRoleIdsStr(s.toString());
- }
-
-
- userVoList.add(userVo);
-
- }
-
- return userVoList;
- }
-
- @Override
- public User findById(String id) {
- return userDao.findById(id);
- }
-
- @Override
- public void update(User user) {
- userDao.update(user);
- }
-
- public void add(User user) {
- //TODO 这里为了完成功能直接按照权限判断添加到staff中,应该新增一个前端页面,进行教师的管理- -!!时间没了,这么做太2了
-
- passwordHelper.encryptPassword(user);
- userDao.add(user);
- String id = user.getUserId();
- String teacherRoleId = roleDao.findByDescription("老师").getId().toString();
- if (user.getRoleIdsStr().indexOf(teacherRoleId) != -1) {
- Staff staff = new Staff();
- staff.setStaffId(id);
- staff.setStaffName(id);
- staffDao.add(staff);
- }
-
-
- }
-
- //TODO 删除staff和student连带的功能未完成
- @Transactional
- @Override
- public void delete(String id) {
- userDao.delete(id);
- }
-
- @Override
- public void changePassword(String userId, String newPassword) {
- User user = userDao.findById(userId);
- user.setPassword(newPassword);
- passwordHelper.encryptPassword(user);
- userDao.update(user);
-
- }
-
- @Override
- public User findByUsername(String username) {
- return userDao.findById(username);
- }
-
- @Override
- public Set findRoles(String username) {
- User user = findByUsername(username);
- if (user == null) {
- return Collections.EMPTY_SET;
- }
- return roleBiz.findRoles(user.getRoleIds().toArray(new Long[0]));
- }
-
- @Override
- public Set findPermissions(String username) {
- User user = findByUsername(username);
- if (user == null) {
- return Collections.EMPTY_SET;
- }
- return roleBiz.findPermissions(user.getRoleIds().toArray(new Long[0]));
- }
-}
-
diff --git a/src/main/java/com/giit/www/util/TaskJob.java b/src/main/java/com/giit/www/util/TaskJob.java
deleted file mode 100644
index 6edf006..0000000
--- a/src/main/java/com/giit/www/util/TaskJob.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.giit.www.util;
-
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Service;
-
-/**
- * Created by c0de8ug on 16-2-15.
- */
-@Component
-public class TaskJob {
- @Scheduled(cron = "0 0 0 1 * ?")
- public void job() {
- TermContainer.update();
- }
-}
diff --git a/src/main/java/com/giit/www/util/Term.java b/src/main/java/com/giit/www/util/Term.java
deleted file mode 100644
index 977b55b..0000000
--- a/src/main/java/com/giit/www/util/Term.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.giit.www.util;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-15.
- */
-public class Term {
- String val;
- String text;
-
- public String getVal() {
- return val;
- }
-
- public void setVal(String val) {
- this.val = val;
- }
-
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-}
diff --git a/src/main/java/com/giit/www/util/TermContainer.java b/src/main/java/com/giit/www/util/TermContainer.java
deleted file mode 100644
index 902c77b..0000000
--- a/src/main/java/com/giit/www/util/TermContainer.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.giit.www.util;
-
-import org.springframework.stereotype.Component;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.util.*;
-
-/**
- * Created by c0de8ug on 16-2-15.
- */
-//TODO 这个类的名字..!!呵呵,实在想不到了
-@Component
-public class TermContainer {
- //TODO 这个volatile用的好像很蠢...一个月一次目测不会出事。。
- static List termList;
- static LocalDate beginTime;
- static HashMap map = new HashMap<>();
- final static String lastTermStr = "上学期";
- final static String nextTermStr = "下学期";
-
- String lastSemester = "2,3,4,5,6,7,8";
- String nextSemester = "1,9,10,11,12";
-
- TermContainer() {
-
-
- for (String temp : lastSemester.split(",")) {
- map.put(temp, lastTermStr);
- }
- for (String temp : nextSemester.split(",")) {
- map.put(temp, nextTermStr);
- }
- beginTime = LocalDate.of(2014, 1, 1);
- update();
- }
-
- public static void update() {
- termList = new ArrayList<>();
-
- LocalDate today = LocalDate.now();
-
-
- int beginYear = beginTime.getYear();
- int todayYear = today.getYear();
- int count = todayYear - beginYear;
-
- if (map.get(String.valueOf(today.getMonthValue())).equals(nextTermStr)) {
- Term term = new Term();
- term.setVal(todayYear + "2");
- term.setText(todayYear + nextTermStr);
- termList.add(term);
- }
- Term term = new Term();
- term.setVal(todayYear + "1");
- term.setText(todayYear + lastTermStr);
- termList.add(term);
-
-
- for (int i = 0; i < count; i++) {
- todayYear--;
- term = new Term();
- term.setVal(todayYear + "2");
- term.setText(todayYear + nextTermStr);
- termList.add(term);
- term = new Term();
- term.setVal(todayYear + "1");
- term.setText(todayYear + lastTermStr);
- termList.add(term);
-
- }
-
- }
-
-
- public static String now() {
- return termList.get(0).getVal();
- }
-
- public static List getTermList() {
- return termList;
- }
-}
diff --git a/src/main/java/com/giit/www/realm/UserRealm.java b/src/main/java/com/realm/UserRealm.java
similarity index 50%
rename from src/main/java/com/giit/www/realm/UserRealm.java
rename to src/main/java/com/realm/UserRealm.java
index 771f203..896e6a0 100644
--- a/src/main/java/com/giit/www/realm/UserRealm.java
+++ b/src/main/java/com/realm/UserRealm.java
@@ -1,62 +1,83 @@
-package com.giit.www.realm;
-
-import com.giit.www.entity.User;
-import com.giit.www.system.service.UserBiz;
-
-import org.apache.shiro.authc.*;
-import org.apache.shiro.authz.AuthorizationInfo;
-import org.apache.shiro.authz.SimpleAuthorizationInfo;
-import org.apache.shiro.realm.AuthorizingRealm;
-import org.apache.shiro.subject.PrincipalCollection;
-import org.apache.shiro.util.ByteSource;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import javax.annotation.Resource;
-
-/**
- * User: Zhang Kaitao
- *
Date: 14-1-28
- *
Version: 1.0
- */
-public class UserRealm extends AuthorizingRealm {
-
- @Resource(name="userBizImpl")
- private UserBiz userBiz;
-
- @Override
- protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
- String username = (String)principals.getPrimaryPrincipal();
-
- SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
- authorizationInfo.setRoles(userBiz.findRoles(username));
- authorizationInfo.setStringPermissions(userBiz.findPermissions(username));
- return authorizationInfo;
- }
-
- @Override
- protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
-
- String username = (String)token.getPrincipal();
-
- User user = userBiz.findById(username);
-
- if(user == null) {
- throw new UnknownAccountException();//没找到帐号
- }
-
- if(Boolean.TRUE.equals(user.getLocked())) {
- throw new LockedAccountException(); //帐号锁定
- }
-
- //交给AuthenticatingRealm使用CredentialsMatcher进行密码匹配,如果觉得人家的不好可以自定义实现
- SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(
- user.getUserId(), //用户名
- user.getPassword(), //密码
- ByteSource.Util.bytes(user.getCredentialsSalt()),//salt=username+salt
- getName() //realm name
- );
- return authenticationInfo;
- }
-
-
-}
+package com.realm;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.shiro.authc.AuthenticationException;
+import org.apache.shiro.authc.AuthenticationInfo;
+import org.apache.shiro.authc.AuthenticationToken;
+import org.apache.shiro.authc.LockedAccountException;
+import org.apache.shiro.authc.SimpleAuthenticationInfo;
+import org.apache.shiro.authc.UnknownAccountException;
+import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.authz.AuthorizationInfo;
+import org.apache.shiro.authz.SimpleAuthorizationInfo;
+import org.apache.shiro.realm.AuthorizingRealm;
+import org.apache.shiro.subject.PrincipalCollection;
+import org.apache.shiro.util.ByteSource;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.entity.Resource;
+import com.entity.User;
+import com.google.common.collect.Sets;
+import com.system.service.ResourceBiz;
+import com.system.service.UserBiz;
+
+/**
+ *
User: Zhang Kaitao
+ *
Date: 14-1-28
+ *
Version: 1.0
+ */
+public class UserRealm extends AuthorizingRealm {
+
+ @Autowired
+ private UserBiz userBiz;
+ @Autowired
+ private ResourceBiz resourceBiz;
+
+ @Override
+ protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
+ String userid = (String)principals.getPrimaryPrincipal();
+
+ SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
+ authorizationInfo.setRoles(userBiz.findRoles(userid));
+ if("admin".equals(userid)) {
+ List list = resourceBiz.findAll();
+ Set set = Sets.newHashSet();
+ for(Resource r : list) {
+ set.add(r.getPermission());
+ }
+ authorizationInfo.setStringPermissions(set);
+ } else {
+ authorizationInfo.setStringPermissions(userBiz.findPermissions(userid));
+ }
+ return authorizationInfo;
+ }
+
+ @Override
+ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException {
+ UsernamePasswordToken token = (UsernamePasswordToken) authcToken;
+ String userid = token.getUsername();
+
+ User user = userBiz.findById(userid);
+
+ if(user == null) {
+ throw new UnknownAccountException();//没找到帐号
+ }
+
+ if(Boolean.TRUE.equals(user.getLocked())) {
+ throw new LockedAccountException(); //帐号锁定
+ }
+
+ //交给AuthenticatingRealm使用CredentialsMatcher进行密码匹配,如果觉得人家的不好可以自定义实现
+ SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(
+ user.getUserId(), //用户名
+ user.getPassword(), //密码
+ ByteSource.Util.bytes(user.getCredentialsSalt()),//salt=username+salt
+ getName() //realm name
+ );
+ return authenticationInfo;
+ }
+
+
+}
diff --git a/src/main/java/com/giit/www/system/controller/AccountController.java b/src/main/java/com/system/controller/AccountController.java
similarity index 79%
rename from src/main/java/com/giit/www/system/controller/AccountController.java
rename to src/main/java/com/system/controller/AccountController.java
index db5a1ce..2f47f8c 100644
--- a/src/main/java/com/giit/www/system/controller/AccountController.java
+++ b/src/main/java/com/system/controller/AccountController.java
@@ -1,36 +1,36 @@
-package com.giit.www.system.controller;
-
-import com.giit.www.system.service.AccountBiz;
-import org.apache.shiro.authz.annotation.RequiresAuthentication;
-import org.apache.shiro.authz.annotation.RequiresRoles;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpSession;
-
-/**
- * Created by c0de8ug on 16-2-16.
- */
-@Controller
-
-@RequestMapping("account.do")
-public class AccountController {
- @Resource(name = "accountBizImpl")
- private AccountBiz accountBiz;
-
- @RequiresAuthentication
- @RequestMapping("profile.view")
- public String profileView() {
- return "/admin/system/account/profile";
-
- }
-
- @RequiresAuthentication
- @RequestMapping("update")
- public String update(HttpSession session, String password) {
- String id = (String) session.getAttribute("username");
- accountBiz.updatePassword(id, password);
- return "redirect:/account.do/profile.view";
- }
-}
+package com.system.controller;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.shiro.authz.annotation.RequiresAuthentication;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.system.service.AccountBiz;
+
+/**
+ * Created by c0de8ug on 16-2-16.
+ */
+@Controller
+
+@RequestMapping("account.do")
+public class AccountController {
+ @Autowired
+ private AccountBiz accountBiz;
+
+ @RequiresAuthentication
+ @RequestMapping("profile.view")
+ public String profileView() {
+ return "/admin/system/account/profile";
+
+ }
+
+ @RequiresAuthentication
+ @RequestMapping("update")
+ public String update(HttpSession session, String password) {
+ String id = (String) session.getAttribute("username");
+ accountBiz.updatePassword(id, password);
+ return "redirect:/account.do/profile.view";
+ }
+}
diff --git a/src/main/java/com/giit/www/system/controller/LoginController.java b/src/main/java/com/system/controller/LoginController.java
similarity index 52%
rename from src/main/java/com/giit/www/system/controller/LoginController.java
rename to src/main/java/com/system/controller/LoginController.java
index ecbda9f..a71e058 100644
--- a/src/main/java/com/giit/www/system/controller/LoginController.java
+++ b/src/main/java/com/system/controller/LoginController.java
@@ -1,64 +1,52 @@
-package com.giit.www.system.controller;
-
-import com.giit.www.entity.User;
-import com.giit.www.system.dao.UserDao;
-import com.giit.www.system.service.AccountBiz;
-import com.giit.www.system.service.UserBiz;
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.authc.IncorrectCredentialsException;
-import org.apache.shiro.authc.UnknownAccountException;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import javax.annotation.Resource;
-import javax.security.auth.Subject;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-/**
- * Created by c0de8ug on 16-2-14.
- */
-@Controller
-public class LoginController {
-
- @Resource(name = "userBizImpl")
- UserBiz userBiz;
-
- @RequestMapping("login")
- public String login(HttpServletRequest req, Model model, HttpSession session) {
- String exceptionClassName = (String) req.getAttribute("shiroLoginFailure");
- String error = null;
- if (UnknownAccountException.class.getName().equals(exceptionClassName)) {
- error = "用户名/密码错误";
- } else if (IncorrectCredentialsException.class.getName().equals(exceptionClassName)) {
- error = "用户名/密码错误";
- } else if (exceptionClassName != null) {
- error = "其他错误:" + exceptionClassName;
- }
-
- //TODO 这里以后可以把角色更换成资源控制后动态生成页面,(-->这里有疑问-->是不是可以使用自定义角色?shiro张开涛的16章有个自定义标签扫描出的角色)
- org.apache.shiro.subject.Subject subject = SecurityUtils.getSubject();
- boolean isAuthenticated = subject.isAuthenticated();
-
- if (isAuthenticated) {
- String principal = (String) subject.getPrincipal();
- session.setAttribute("username", principal);
-
- switch (principal) {
- case "admin":
- return "/admin/main";
- case "teacher":
- return "/teacher/main";
- case "student":
- return "/student/main";
- case "supplier":
- return "redirect:supplier.do/supplier.view";
- }
- }
-
- return "redirect:login.jsp";
- }
-
-
-}
+package com.system.controller;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.IncorrectCredentialsException;
+import org.apache.shiro.authc.UnknownAccountException;
+import org.apache.shiro.subject.Subject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.system.service.UserBiz;
+
+/**
+ * Created by c0de8ug on 16-2-14.
+ */
+@Controller
+public class LoginController {
+
+ @Autowired
+ UserBiz userBiz;
+
+ @RequestMapping("login")
+ public String login(HttpServletRequest req, ModelMap modelMap, HttpSession session) {
+ String exceptionClassName = (String) req.getAttribute("shiroLoginFailure");
+ String error = null;
+ if (UnknownAccountException.class.getName().equals(exceptionClassName)) {
+ error = "用户名/密码错误";
+ } else if (IncorrectCredentialsException.class.getName().equals(exceptionClassName)) {
+ error = "用户名/密码错误";
+ } else if (exceptionClassName != null) {
+ error = "其他错误:" + exceptionClassName;
+ }
+ modelMap.put("msg", error);
+
+ Subject subject = SecurityUtils.getSubject();
+ boolean isAuthenticated = subject.isAuthenticated();
+
+ if (isAuthenticated) {
+ String principal = (String) subject.getPrincipal();
+ session.setAttribute("username", principal);
+ return "/admin/main";
+ }
+
+ return "forward:login.jsp";
+ }
+
+
+}
diff --git a/src/main/java/com/system/controller/MainController.java b/src/main/java/com/system/controller/MainController.java
new file mode 100644
index 0000000..c461fe8
--- /dev/null
+++ b/src/main/java/com/system/controller/MainController.java
@@ -0,0 +1,14 @@
+package com.system.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+@RequestMapping("main.do")
+public class MainController {
+
+ @RequestMapping("admin")
+ public String adminMainView() {
+ return "/admin/main";
+ }
+}
diff --git a/src/main/java/com/system/controller/ResourceController.java b/src/main/java/com/system/controller/ResourceController.java
new file mode 100644
index 0000000..765d330
--- /dev/null
+++ b/src/main/java/com/system/controller/ResourceController.java
@@ -0,0 +1,78 @@
+package com.system.controller;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.entity.Resource;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.system.service.ResourceBiz;
+
+@Controller
+@RequestMapping("/resource.do")
+public class ResourceController {
+ Logger log = Logger.getLogger(ResourceController.class);
+
+ @Autowired
+ private ResourceBiz resourceBiz;
+
+ @RequiresPermissions("resource:query")
+ @RequestMapping("resource.view")
+ public String resourceView(Model model) {
+ return "forward:/resource.do/resource.view/0/10";
+ }
+
+ @RequiresPermissions("resource:query")
+ @RequestMapping("resource.view/{pageNum}/{pageSize}")
+ public String resourceView(Model model,@PathVariable("pageNum") int pageNum,
+ @PathVariable("pageSize") int pageSize) {
+ PageHelper.startPage(pageNum, pageSize);
+ List resourceList = resourceBiz.findAll();
+ PageInfo page = new PageInfo(resourceList);
+ model.addAttribute("resourceList",resourceList);
+ model.addAttribute("page",page);
+ return "/admin/system/resource/resource";
+ }
+
+ @RequiresPermissions("resource:add")
+ @RequestMapping("resource_add.view")
+ public String resourceAddView(Model model) {
+ return "/admin/system/resource/resource_add";
+ }
+
+ @RequiresPermissions("resource:add")
+ @RequestMapping("add")
+ public String add(com.entity.Resource resource, RedirectAttributes redirectAttributes) {
+ resourceBiz.createResource(resource);
+ return "redirect:/resource.do/resource.view";
+ }
+
+ @RequiresPermissions("resource:update")
+ @RequestMapping("resource_update.view")
+ public String resourceUpdateView(Long id,Model model) {
+ model.addAttribute("resource", resourceBiz.findOne(id));
+ return "/admin/system/resource/resource_update";
+ }
+
+ @RequiresPermissions("resource:update")
+ @RequestMapping("update")
+ public String update(com.entity.Resource resource, RedirectAttributes redirectAttributes) {
+ resourceBiz.updateResource(resource);
+ return "redirect:/resource.do/resource.view";
+ }
+
+ @RequiresPermissions("resource:delete")
+ @RequestMapping("delete")
+ public String delete(Long id, RedirectAttributes redirectAttributes) {
+ resourceBiz.deleteResource(id);
+ return "redirect:/resource.do/resource.view";
+ }
+}
diff --git a/src/main/java/com/system/controller/RoleController.java b/src/main/java/com/system/controller/RoleController.java
new file mode 100644
index 0000000..ca162fa
--- /dev/null
+++ b/src/main/java/com/system/controller/RoleController.java
@@ -0,0 +1,87 @@
+package com.system.controller;
+
+import java.util.List;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.entity.Role;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.system.service.ResourceBiz;
+import com.system.service.RoleBiz;
+
+/**
+ * Created by c0de8ug on 16-2-21.
+ */
+@Controller
+
+@RequestMapping("/role.do")
+public class RoleController {
+
+
+ @Autowired
+ private RoleBiz roleBiz;
+
+ @Autowired
+ private ResourceBiz resourceBiz;
+
+ @RequiresPermissions("role:query")
+ @RequestMapping("role.view")
+ public String roleView(Model model) {
+ return "forward:/role.do/role.view/0/10";
+ }
+
+ @RequiresPermissions("role:query")
+ @RequestMapping("role.view/{pageNum}/{pageSize}")
+ public String roleView(Model model,@PathVariable("pageNum") int pageNum,
+ @PathVariable("pageSize") int pageSize) {
+ PageHelper.startPage(pageNum, pageSize);
+ List list = roleBiz.findAll();
+ PageInfo page = new PageInfo(list);
+ model.addAttribute("roleList",list);
+ model.addAttribute("page",page);
+ return "/admin/system/role/role";
+ }
+
+ @RequiresPermissions("role:add")
+ @RequestMapping("role_add.view")
+ public String roleAddView(Model model) {
+ model.addAttribute("resourceList", resourceBiz.findAll());
+ return "/admin/system/role/role_add";
+ }
+
+ @RequiresPermissions("role:update")
+ @RequestMapping("role_update.view")
+ public String roleUpdateView(Long id,Model model) {
+ model.addAttribute("role", roleBiz.findOne(id));
+ model.addAttribute("resourceList", resourceBiz.findAll());
+ return "/admin/system/role/role_update";
+ }
+
+ @RequiresPermissions("role:add")
+ @RequestMapping("add")
+ public String add(Role role, RedirectAttributes redirectAttributes) {
+ roleBiz.createRole(role);
+ return "redirect:/role.do/role.view";
+ }
+
+ @RequiresPermissions("role:update")
+ @RequestMapping("update")
+ public String update(Role role, RedirectAttributes redirectAttributes) {
+ roleBiz.updateRole(role);
+ return "redirect:/role.do/role.view";
+ }
+
+ @RequiresPermissions("role:delete")
+ @RequestMapping("delete")
+ public String delete(Long id, RedirectAttributes redirectAttributes) {
+ roleBiz.deleteRole(id);
+ return "redirect:/role.do/role.view";
+ }
+}
diff --git a/src/main/java/com/system/controller/UserController.java b/src/main/java/com/system/controller/UserController.java
new file mode 100644
index 0000000..3e70f6e
--- /dev/null
+++ b/src/main/java/com/system/controller/UserController.java
@@ -0,0 +1,84 @@
+package com.system.controller;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.entity.User;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.system.service.RoleBiz;
+import com.system.service.UserBiz;
+
+@Controller
+@RequestMapping("user.do")
+public class UserController {
+
+ @Autowired
+ private UserBiz userBiz;
+
+ @Autowired
+ private RoleBiz roleBiz;
+
+ @RequiresPermissions("user:query")
+ @RequestMapping("user.view")
+ public String userView(Model model) {
+ return "forward:/user.do/user.view/0/10";
+ }
+
+ @RequiresPermissions("user:query")
+ @RequestMapping("user.view/{pageNum}/{pageSize}")
+ public String userView(Model m,@PathVariable("pageNum") int pageNum,
+ @PathVariable("pageSize") int pageSize) throws InvocationTargetException, IllegalAccessException {
+ PageHelper.startPage(pageNum, pageSize);
+ List list = userBiz.findAll();
+ PageInfo page = new PageInfo(list);
+ m.addAttribute("userList",list);
+ m.addAttribute("page",page);
+ return "/admin/system/user/user";
+ }
+
+ @RequiresPermissions("user:add")
+ @RequestMapping("user_add.view")
+ public String userAddView(Model m) {
+ m.addAttribute("roleList", roleBiz.findAll());
+ return "/admin/system/user/user_add";
+ }
+
+ @RequiresPermissions("user:add")
+ @RequestMapping("findById")
+ public String findById(String id, Model m) {
+ m.addAttribute("user", userBiz.findById(id));
+ m.addAttribute("roleList", roleBiz.findAll());
+ return "/admin/system/user/user_update";
+ }
+
+ @RequiresPermissions("user:update")
+ @RequestMapping("update")
+ public String update(User user) {
+ userBiz.update(user);
+ return "redirect:/user.do/user.view";
+ }
+
+ @RequiresPermissions("user:add")
+ @RequestMapping("add")
+ public String add(User user) {
+
+ userBiz.add(user);
+ return "redirect:/user.do/user.view";
+ }
+
+ @RequiresPermissions("user:delete")
+ @RequestMapping("delete")
+ public String delete(String id) {
+ userBiz.delete(id);
+ return "redirect:/user.do/user.view";
+ }
+
+}
diff --git a/src/main/java/com/system/dao/ResourceDao.java b/src/main/java/com/system/dao/ResourceDao.java
new file mode 100644
index 0000000..f1ce376
--- /dev/null
+++ b/src/main/java/com/system/dao/ResourceDao.java
@@ -0,0 +1,19 @@
+package com.system.dao;
+
+
+import java.util.List;
+
+import com.entity.Resource;
+
+public interface ResourceDao {
+
+ public void createResource(Resource resource);
+
+ public void updateResource(Resource resource);
+
+ public void deleteResource(Long resourceId);
+
+ Resource findOne(Long resourceId);
+
+ List findAll();
+}
diff --git a/src/main/java/com/giit/www/system/dao/RoleDao.java b/src/main/java/com/system/dao/RoleDao.java
similarity index 83%
rename from src/main/java/com/giit/www/system/dao/RoleDao.java
rename to src/main/java/com/system/dao/RoleDao.java
index 6776f93..fcac7f0 100644
--- a/src/main/java/com/giit/www/system/dao/RoleDao.java
+++ b/src/main/java/com/system/dao/RoleDao.java
@@ -1,26 +1,26 @@
-package com.giit.www.system.dao;
-
-
-import com.giit.www.entity.Role;
-
-import java.util.List;
-
-/**
- * User: Zhang Kaitao
- *
Date: 14-1-28
- *
Version: 1.0
- */
-public interface RoleDao {
-
- public void createRole(Role role);
-
- public void updateRole(Role role);
-
- public void deleteRole(Long roleId);
-
- public Role findOne(Long roleId);
-
- public Role findByDescription(String description);
-
- public List findAll();
-}
+package com.system.dao;
+
+
+import com.entity.Role;
+
+import java.util.List;
+
+/**
+ * User: Zhang Kaitao
+ *
Date: 14-1-28
+ *
Version: 1.0
+ */
+public interface RoleDao {
+
+ public void createRole(Role role);
+
+ public void updateRole(Role role);
+
+ public void deleteRole(Long roleId);
+
+ public Role findOne(Long roleId);
+
+ public Role findByDescription(String description);
+
+ public List findAll();
+}
diff --git a/src/main/java/com/giit/www/system/dao/UserDao.java b/src/main/java/com/system/dao/UserDao.java
similarity index 81%
rename from src/main/java/com/giit/www/system/dao/UserDao.java
rename to src/main/java/com/system/dao/UserDao.java
index 4499d2d..e4e6c96 100644
--- a/src/main/java/com/giit/www/system/dao/UserDao.java
+++ b/src/main/java/com/system/dao/UserDao.java
@@ -1,27 +1,28 @@
-package com.giit.www.system.dao;
-
-import com.giit.www.entity.User;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public interface UserDao {
- public List findAll();
-
- public User findById(String id);
-
- public void update(User user);
-
- public void add(User user);
-
- public void delete(String id);
-
- public User findByIdAndPassword(@Param("id") String username, @Param("password") String password);
-
- public void updatePassword(@Param("userId") String id, @Param("password") String password);
-
- User findByUsername(String username);
-}
+package com.system.dao;
+
+import com.entity.User;
+
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Created by c0de8ug on 16-2-9.
+ */
+public interface UserDao {
+ public List findAll();
+
+ public User findById(String id);
+
+ public void update(User user);
+
+ public void add(User user);
+
+ public void delete(String id);
+
+ public User findByIdAndPassword(@Param("id") String username, @Param("password") String password);
+
+ public void updatePassword(@Param("userId") String id, @Param("password") String password);
+
+ public List findByRole(String role);
+}
diff --git a/src/main/java/com/system/interceptor/BreadcrumbIntercepter.java b/src/main/java/com/system/interceptor/BreadcrumbIntercepter.java
new file mode 100644
index 0000000..799ccad
--- /dev/null
+++ b/src/main/java/com/system/interceptor/BreadcrumbIntercepter.java
@@ -0,0 +1,96 @@
+package com.system.interceptor;
+
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.log4j.Logger;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.subject.Subject;
+import org.springframework.web.servlet.HandlerInterceptor;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.google.common.collect.Lists;
+import com.system.model.Breadcrumb;
+
+public class BreadcrumbIntercepter implements HandlerInterceptor {
+ private Logger log = Logger.getLogger(BreadcrumbIntercepter.class);
+ private Properties properties;
+ //private Pattern p1 = Pattern.compile("[//\\a-zA-Z]+?(? 0) {
+ Subject subject = SecurityUtils.getSubject();
+ if(subject.isAuthenticated()) {
+ List breadcrumbs = Lists.newArrayList(new Breadcrumb(properties.getProperty("login"), httpServletRequest.getContextPath()+"/main.do/admin"));
+ session.setAttribute("breadcrumbs", breadcrumbs);
+ return true;
+ }
+ }
+
+ if(url.indexOf("view") == -1 || url.indexOf("external") != -1) return true;
+
+ List breadcrumbs = (List)session.getAttribute("breadcrumbs");
+ Matcher matcher = pc.matcher(url);
+ matcher.find();
+ String cato = matcher.group(1);
+
+ if(properties.getProperty(cato)==null) {
+ log.warn("没有配置的路径类型:"+cato+"("+url+")");
+ return true;
+ }
+
+ if(url.matches("[//\\a-zA-Z]+?(?User: Zhang Kaitao
- * Date: 14-1-28
- *
Version: 1.0
- */
-public interface ResourceBiz {
-
-
- public Resource createResource(Resource resource);
- public Resource updateResource(Resource resource);
- public void deleteResource(Long resourceId);
-
- Resource findOne(Long resourceId);
- List findAll();
-
- /**
- * 得到资源对应的权限字符串
- * @param resourceIds
- * @return
- */
- Set findPermissions(Set resourceIds);
-
- /**
- * 根据用户权限得到菜单
- * @param permissions
- * @return
- */
- List findMenus(Set permissions);
-}
+package com.system.service;
+
+
+import com.entity.Resource;
+
+import java.util.List;
+import java.util.Set;
+
+public interface ResourceBiz {
+
+
+ public void createResource(Resource resource);
+ public void updateResource(Resource resource);
+ public void deleteResource(Long resourceId);
+
+ Resource findOne(Long resourceId);
+ List findAll();
+
+ /**
+ * 得到资源对应的权限字符串
+ * @param resourceIds
+ * @return
+ */
+ Set findPermissions(Set resourceIds);
+
+ /**
+ * 根据用户权限得到菜单
+ * @param permissions
+ * @return
+ */
+ List findMenus(Set permissions);
+ Set findPermissionNames(Set resourceIds);
+}
diff --git a/src/main/java/com/giit/www/system/service/RoleBiz.java b/src/main/java/com/system/service/RoleBiz.java
similarity index 87%
rename from src/main/java/com/giit/www/system/service/RoleBiz.java
rename to src/main/java/com/system/service/RoleBiz.java
index 54f0f57..0f74c67 100644
--- a/src/main/java/com/giit/www/system/service/RoleBiz.java
+++ b/src/main/java/com/system/service/RoleBiz.java
@@ -1,42 +1,42 @@
-package com.giit.www.system.service;
-
-
-import com.giit.www.entity.Role;
-
-import java.util.List;
-import java.util.Set;
-
-/**
- * User: Zhang Kaitao
- *
Date: 14-1-28
- *
Version: 1.0
- */
-public interface RoleBiz {
-
-
- public void createRole(Role role);
-
- public void updateRole(Role role);
-
- public void deleteRole(Long roleId);
-
- public Role findOne(Long roleId);
-
- public List findAll();
-
- /**
- * 根据角色编号得到角色标识符列表
- *
- * @param roleIds
- * @return
- */
- Set findRoles(Long... roleIds);
-
- /**
- * 根据角色编号得到权限字符串列表
- *
- * @param roleIds
- * @return
- */
- Set findPermissions(Long[] roleIds);
-}
+package com.system.service;
+
+
+import com.entity.Role;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * User: Zhang Kaitao
+ *
Date: 14-1-28
+ *
Version: 1.0
+ */
+public interface RoleBiz {
+
+
+ public void createRole(Role role);
+
+ public void updateRole(Role role);
+
+ public void deleteRole(Long roleId);
+
+ public Role findOne(Long roleId);
+
+ public List findAll();
+
+ /**
+ * 根据角色编号得到角色标识符列表
+ *
+ * @param roleIds
+ * @return
+ */
+ Set findRoles(Long... roleIds);
+
+ /**
+ * 根据角色编号得到权限字符串列表
+ *
+ * @param roleIds
+ * @return
+ */
+ Set findPermissions(Long[] roleIds);
+}
diff --git a/src/main/java/com/giit/www/system/service/UserBiz.java b/src/main/java/com/system/service/UserBiz.java
similarity index 66%
rename from src/main/java/com/giit/www/system/service/UserBiz.java
rename to src/main/java/com/system/service/UserBiz.java
index 96699b6..a498b52 100644
--- a/src/main/java/com/giit/www/system/service/UserBiz.java
+++ b/src/main/java/com/system/service/UserBiz.java
@@ -1,33 +1,32 @@
-package com.giit.www.system.service;
-
-
-import com.giit.www.entity.User;
-import com.giit.www.entity.custom.UserVo;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Created by c0de8ug on 16-2-9.
- */
-public interface UserBiz {
- public List findAll() throws InvocationTargetException, IllegalAccessException;
-
- public User findById(String id);
-
- public void update(User user);
-
- public void add(User user);
-
- public void delete(String id);
-
- public void changePassword(String userId, String newPassword);
-
-
- public User findByUsername(String username);
-
- public Set findRoles(String username);
-
- public Set findPermissions(String username);
-}
+package com.system.service;
+
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.Set;
+
+import com.entity.User;
+
+/**
+ * Created by c0de8ug on 16-2-9.
+ */
+public interface UserBiz {
+ public List findAll() throws InvocationTargetException, IllegalAccessException;
+
+ public User findById(String id);
+
+ public void update(User user);
+
+ public void add(User user);
+
+ public void delete(String id);
+
+ public void changePassword(String userId, String newPassword);
+
+
+ public Set findRoles(String username);
+
+ public Set findPermissions(String username);
+
+ public List findByRole(String string);
+}
diff --git a/src/main/java/com/system/service/impl/AccountBizImpl.java b/src/main/java/com/system/service/impl/AccountBizImpl.java
new file mode 100644
index 0000000..b06a06e
--- /dev/null
+++ b/src/main/java/com/system/service/impl/AccountBizImpl.java
@@ -0,0 +1,35 @@
+package com.system.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.entity.User;
+import com.system.dao.UserDao;
+import com.system.service.AccountBiz;
+import com.util.PasswordHelper;
+
+/**
+ * Created by c0de8ug on 16-2-14.
+ */
+@Service
+public class AccountBizImpl implements AccountBiz {
+
+ @Autowired
+ UserDao userDao;
+
+ @Autowired
+ private PasswordHelper passwordHelper;
+
+ @Override
+ public User findByIdAndPassword(String username, String password) {
+ return userDao.findByIdAndPassword(username, password);
+ }
+
+
+ @Override
+ public void updatePassword(String id, String password) {
+ User user = userDao.findById(id);
+ password = passwordHelper.encryptPassword(password,user.getCredentialsSalt());
+ userDao.updatePassword(id, password);
+ }
+}
diff --git a/src/main/java/com/giit/www/system/service/impl/ResourceBizImpl.java b/src/main/java/com/system/service/impl/ResourceBizImpl.java
similarity index 68%
rename from src/main/java/com/giit/www/system/service/impl/ResourceBizImpl.java
rename to src/main/java/com/system/service/impl/ResourceBizImpl.java
index a3a34a9..9659a93 100644
--- a/src/main/java/com/giit/www/system/service/impl/ResourceBizImpl.java
+++ b/src/main/java/com/system/service/impl/ResourceBizImpl.java
@@ -1,95 +1,98 @@
-package com.giit.www.system.service.impl;
-
-import com.giit.www.entity.Resource;
-import com.giit.www.system.dao.ResourceDao;
-import com.giit.www.system.service.ResourceBiz;
-import org.apache.shiro.authz.permission.WildcardPermission;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * User: Zhang Kaitao
- *
Date: 14-2-14
- *
Version: 1.0
- */
-@Service
-public class ResourceBizImpl implements ResourceBiz {
-
- @javax.annotation.Resource
- private ResourceDao resourceDao;
-
- @Override
- public Resource createResource(Resource resource) {
- return resourceDao.createResource(resource);
- }
-
- @Override
- public Resource updateResource(Resource resource) {
- return resourceDao.updateResource(resource);
- }
-
- @Override
- public void deleteResource(Long resourceId) {
- resourceDao.deleteResource(resourceId);
- }
-
- @Override
- public Resource findOne(Long resourceId) {
- return resourceDao.findOne(resourceId);
- }
-
- @Override
- public List findAll() {
- return resourceDao.findAll();
- }
-
- @Override
- public Set findPermissions(Set resourceIds) {
- Set permissions = new HashSet();
- for (Long resourceId : resourceIds) {
- Resource resource = findOne(resourceId);
- if (resource != null && !StringUtils.isEmpty(resource.getPermission())) {
- permissions.add(resource.getPermission());
- }
- }
- return permissions;
- }
-
- @Override
- public List findMenus(Set permissions) {
- List allResources = findAll();
- List menus = new ArrayList();
- for (Resource resource : allResources) {
- if (resource.isRootNode()) {
- continue;
- }
- if (resource.getType() != Resource.ResourceType.menu) {
- continue;
- }
- if (!hasPermission(permissions, resource)) {
- continue;
- }
- menus.add(resource);
- }
- return menus;
- }
-
- private boolean hasPermission(Set permissions, Resource resource) {
- if (StringUtils.isEmpty(resource.getPermission())) {
- return true;
- }
- for (String permission : permissions) {
- WildcardPermission p1 = new WildcardPermission(permission);
- WildcardPermission p2 = new WildcardPermission(resource.getPermission());
- if (p1.implies(p2) || p2.implies(p1)) {
- return true;
- }
- }
- return false;
- }
-}
+package com.system.service.impl;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.shiro.authz.permission.WildcardPermission;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.entity.Resource;
+import com.system.dao.ResourceDao;
+import com.system.service.ResourceBiz;
+
+@Service
+public class ResourceBizImpl implements ResourceBiz {
+
+ @Autowired
+ private ResourceDao resourceDao;
+
+ @Override
+ public void createResource(Resource resource) {
+ resourceDao.createResource(resource);
+ }
+
+ @Override
+ public void updateResource(Resource resource) {
+ resourceDao.updateResource(resource);
+ }
+
+ @Override
+ public void deleteResource(Long resourceId) {
+ resourceDao.deleteResource(resourceId);
+ }
+
+ @Override
+ public Resource findOne(Long resourceId) {
+ return resourceDao.findOne(resourceId);
+ }
+
+ @Override
+ public List findAll() {
+ return resourceDao.findAll();
+ }
+
+ @Override
+ public Set findPermissions(Set resourceIds) {
+ Set permissions = new HashSet();
+ for (Long resourceId : resourceIds) {
+ Resource resource = findOne(resourceId);
+ if (resource != null && !StringUtils.isEmpty(resource.getPermission())) {
+ permissions.add(resource.getPermission());
+ }
+ }
+ return permissions;
+ }
+
+ @Override
+ public Set findPermissionNames(Set resourceIds) {
+ Set names = new HashSet();
+ for (Long resourceId : resourceIds) {
+ Resource resource = findOne(resourceId);
+ if (resource != null && !StringUtils.isEmpty(resource.getPermission())) {
+ names.add(resource.getName());
+ }
+ }
+ return names;
+ }
+
+ @Override
+ public List findMenus(Set permissions) {
+ List allResources = findAll();
+ List menus = new ArrayList();
+ for (Resource resource : allResources) {
+ if (!hasPermission(permissions, resource)) {
+ continue;
+ }
+ menus.add(resource);
+ }
+ return menus;
+ }
+
+ private boolean hasPermission(Set permissions, Resource resource) {
+ if (StringUtils.isEmpty(resource.getPermission())) {
+ return true;
+ }
+ for (String permission : permissions) {
+ WildcardPermission p1 = new WildcardPermission(permission);
+ WildcardPermission p2 = new WildcardPermission(resource.getPermission());
+ if (p1.implies(p2) || p2.implies(p1)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/com/giit/www/system/service/impl/RoleBizImpl.java b/src/main/java/com/system/service/impl/RoleBizImpl.java
similarity index 66%
rename from src/main/java/com/giit/www/system/service/impl/RoleBizImpl.java
rename to src/main/java/com/system/service/impl/RoleBizImpl.java
index be7a65f..ae225be 100644
--- a/src/main/java/com/giit/www/system/service/impl/RoleBizImpl.java
+++ b/src/main/java/com/system/service/impl/RoleBizImpl.java
@@ -1,73 +1,81 @@
-package com.giit.www.system.service.impl;
-
-import com.giit.www.entity.Role;
-import com.giit.www.system.dao.RoleDao;
-import com.giit.www.system.service.ResourceBiz;
-import com.giit.www.system.service.RoleBiz;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * User: Zhang Kaitao
- *
Date: 14-1-28
- *
Version: 1.0
- */
-@Service
-public class RoleBizImpl implements RoleBiz {
-
- @Resource
- private RoleDao roleDao;
- @Resource(name = "resourceBizImpl")
- private ResourceBiz resourceBiz;
-
- public void createRole(Role role) {
- roleDao.createRole(role);
- }
-
- public void updateRole(Role role) {
- roleDao.updateRole(role);
- }
-
- public void deleteRole(Long roleId) {
- roleDao.deleteRole(roleId);
- }
-
- @Override
- public Role findOne(Long roleId) {
- return roleDao.findOne(roleId);
- }
-
- @Override
- public List findAll() {
- return roleDao.findAll();
- }
-
- @Override
- public Set findRoles(Long... roleIds) {
- Set roles = new HashSet();
- for (Long roleId : roleIds) {
- Role role = findOne(roleId);
- if (role != null) {
- roles.add(role.getRole());
- }
- }
- return roles;
- }
-
- @Override
- public Set findPermissions(Long[] roleIds) {
- Set resourceIds = new HashSet();
- for (Long roleId : roleIds) {
- Role role = findOne(roleId);
- if (role != null) {
- resourceIds.addAll(role.getResourceIds());
- }
- }
- return resourceBiz.findPermissions(resourceIds);
- }
-}
+package com.system.service.impl;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.entity.Role;
+import com.google.common.collect.Sets;
+import com.system.dao.RoleDao;
+import com.system.service.ResourceBiz;
+import com.system.service.RoleBiz;
+
+/**
+ * User: Zhang Kaitao
+ *
Date: 14-1-28
+ *
Version: 1.0
+ */
+@Service
+public class RoleBizImpl implements RoleBiz {
+
+ @Autowired
+ private RoleDao roleDao;
+ @Autowired
+ private ResourceBiz resourceBiz;
+
+ public void createRole(Role role) {
+ roleDao.createRole(role);
+ }
+
+ public void updateRole(Role role) {
+ roleDao.updateRole(role);
+ }
+
+ public void deleteRole(Long roleId) {
+ roleDao.deleteRole(roleId);
+ }
+
+ @Override
+ public Role findOne(Long roleId) {
+ return roleDao.findOne(roleId);
+ }
+
+ @Override
+ public List findAll() {
+ List list = roleDao.findAll();
+ for(Role role : list) {
+ if(StringUtils.isEmpty(role.getResourceIdsStr())) continue;
+ Set set = resourceBiz.findPermissionNames(Sets.newHashSet(role.getResourceIds()));
+ role.setResourceNames(StringUtils.join(set.iterator(), ","));
+ }
+ return list;
+ }
+
+ @Override
+ public Set findRoles(Long... roleIds) {
+ Set roles = new HashSet();
+ for (Long roleId : roleIds) {
+ Role role = findOne(roleId);
+ if (role != null) {
+ roles.add(role.getRole());
+ }
+ }
+ return roles;
+ }
+
+ @Override
+ public Set findPermissions(Long[] roleIds) {
+ Set resourceIds = new HashSet();
+ for (Long roleId : roleIds) {
+ Role role = findOne(roleId);
+ if (role != null) {
+ resourceIds.addAll(role.getResourceIds());
+ }
+ }
+ return resourceBiz.findPermissions(resourceIds);
+ }
+}
diff --git a/src/main/java/com/system/service/impl/UserBizImpl.java b/src/main/java/com/system/service/impl/UserBizImpl.java
new file mode 100644
index 0000000..95fb9e6
--- /dev/null
+++ b/src/main/java/com/system/service/impl/UserBizImpl.java
@@ -0,0 +1,123 @@
+package com.system.service.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.entity.Role;
+import com.entity.User;
+import com.system.dao.RoleDao;
+import com.system.dao.UserDao;
+import com.system.service.RoleBiz;
+import com.system.service.UserBiz;
+import com.util.PasswordHelper;
+
+/**
+ * Created by c0de8ug on 16-2-9.
+ */
+
+@Service
+public class UserBizImpl implements UserBiz {
+
+ @Autowired
+ UserDao userDao;
+
+ @Autowired
+ RoleDao roleDao;
+
+ @Autowired
+ private PasswordHelper passwordHelper;
+ @Autowired
+ private RoleBiz roleBiz;
+
+ @Override
+ public List findAll() throws InvocationTargetException, IllegalAccessException {
+ List userList = userDao.findAll();
+ Iterator iterator = userList.iterator();
+
+ while (iterator.hasNext()) {
+ StringBuilder s = new StringBuilder();
+ User user = (User) iterator.next();
+ List roleIds = user.getRoleIds();
+
+ if (roleIds != null) {
+ int i = 0;
+ int size = roleIds.size();
+ for (; i < size - 1; i++) {
+ Role role = roleDao.findOne(roleIds.get(i));
+
+ s.append(role.getDescription());
+ s.append(",");
+ }
+ Role role = roleDao.findOne(roleIds.get(i));
+ s.append(role.getDescription());
+ user.setRoleDesc(s.toString());
+ }
+ }
+ return userList;
+ }
+
+ @Override
+ public List findByRole(String role) {
+ return userDao.findByRole(role);
+ }
+
+ @Override
+ public User findById(String id) {
+ return userDao.findById(id);
+ }
+
+ @Override
+ public void update(User user) {
+ if(user.getPassword()!=null) {
+ String newPw = passwordHelper.encryptPassword(user.getPassword(), user.getSalt());
+ user.setPassword(newPw);
+ }
+ userDao.update(user);
+ }
+
+ public void add(User user) {
+ passwordHelper.encryptPassword(user);
+ userDao.add(user);
+ }
+
+ @Transactional
+ @Override
+ public void delete(String id) {
+ userDao.delete(id);
+ }
+
+ @Override
+ public void changePassword(String userId, String newPassword) {
+ User user = userDao.findById(userId);
+ user.setPassword(newPassword);
+ passwordHelper.encryptPassword(user);
+ userDao.update(user);
+
+ }
+
+ @Override
+ public Set findRoles(String userid) {
+ User user = findById(userid);
+ if (user == null) {
+ return Collections.emptySet();
+ }
+ return roleBiz.findRoles(user.getRoleIds().toArray(new Long[0]));
+ }
+
+ @Override
+ public Set findPermissions(String userid) {
+ User user = findById(userid);
+ if (user == null) {
+ return Collections.emptySet();
+ }
+ return roleBiz.findPermissions(user.getRoleIds().toArray(new Long[0]));
+ }
+}
+
diff --git a/src/main/java/com/util/Constant.java b/src/main/java/com/util/Constant.java
new file mode 100644
index 0000000..6f54626
--- /dev/null
+++ b/src/main/java/com/util/Constant.java
@@ -0,0 +1,19 @@
+package com.util;
+
+/**
+ * 系统常量
+ *
+ * @author wujuan
+ *
+ */
+public class Constant {
+
+ public static final String MSG_ERROR = "-1";
+ public static final String MSG_CONFLICT = "-2";
+ public static final String MSG_OK = "0";
+
+ public static final String OK_SYS = "成功";
+ public static final String ERROR_SYS = "系统错误";
+ public static final String ERROR_ANALY = "json解析错误";
+
+}
diff --git a/src/main/java/com/util/FtpClient.java b/src/main/java/com/util/FtpClient.java
new file mode 100644
index 0000000..662273d
--- /dev/null
+++ b/src/main/java/com/util/FtpClient.java
@@ -0,0 +1,86 @@
+package com.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import com.enterprisedt.net.ftp.FTPClient;
+import com.enterprisedt.net.ftp.FTPConnectMode;
+import com.enterprisedt.net.ftp.FTPException;
+import com.enterprisedt.net.ftp.FTPTransferType;
+
+public class FtpClient {
+ private FTPClient ftpClient = null;
+
+ public void connectServer(String server, String user, String password) throws IOException, FTPException {
+ if (ftpClient == null || !ftpClient.connected()) {
+ ftpClient = new FTPClient();
+ ftpClient.setRemoteHost(server);
+ ftpClient.setTimeout(500000);
+ ftpClient.connect();
+ ftpClient.login(user, password);
+ ftpClient.setConnectMode(FTPConnectMode.PASV);
+ ftpClient.setType(FTPTransferType.BINARY);
+ }
+ }
+
+ public void changeDir(String path) {
+ if (path == null || path.equals("")) {
+ return;
+ }
+ String temp[] = path.split("/");
+ for (int i = 0; i < temp.length; i++) {
+ try {
+ if (temp[i] == null || temp[i].equals("")) {
+ continue;
+ }
+ ftpClient.chdir(temp[i]);
+ } catch (FTPException fe) {
+ try {
+ ftpClient.mkdir(temp[i]);
+ ftpClient.chdir(temp[i]);
+ } catch (Exception e) {
+
+ }
+ } catch (Exception ee) {
+
+ }
+ }
+ }
+
+ public void uploadFile(InputStream in, String filename) {
+ try {
+ ftpClient.put(in, filename);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void uploadFile(byte[] bytes, String filename) {
+ try {
+ ftpClient.put(bytes, filename);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void downLoad(OutputStream out, String filename) {
+ try {
+ ftpClient.get(out, filename);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void close() {
+ try {
+ if (ftpClient != null && ftpClient.connected()) {
+ ftpClient.quit();
+ ftpClient = null;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/src/main/java/com/giit/www/util/PasswordHelper.java b/src/main/java/com/util/PasswordHelper.java
similarity index 66%
rename from src/main/java/com/giit/www/util/PasswordHelper.java
rename to src/main/java/com/util/PasswordHelper.java
index 2df98f3..06c41c4 100644
--- a/src/main/java/com/giit/www/util/PasswordHelper.java
+++ b/src/main/java/com/util/PasswordHelper.java
@@ -1,48 +1,66 @@
-package com.giit.www.util;
-
-import com.giit.www.entity.User;
-import org.apache.shiro.crypto.RandomNumberGenerator;
-import org.apache.shiro.crypto.SecureRandomNumberGenerator;
-import org.apache.shiro.crypto.hash.SimpleHash;
-import org.apache.shiro.util.ByteSource;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-
-/**
- * User: Zhang Kaitao
- *
Date: 14-1-28
- *
Version: 1.0
- */
-@Service
-public class PasswordHelper {
-
- private RandomNumberGenerator randomNumberGenerator = new SecureRandomNumberGenerator();
-
- private String algorithmName = "md5";
- private int hashIterations = 1;
-
- public void setRandomNumberGenerator(RandomNumberGenerator randomNumberGenerator) {
- this.randomNumberGenerator = randomNumberGenerator;
- }
-
- public void setAlgorithmName(String algorithmName) {
- this.algorithmName = algorithmName;
- }
-
- public void setHashIterations(int hashIterations) {
- this.hashIterations = hashIterations;
- }
-
- public void encryptPassword(User user) {
-
- user.setSalt(randomNumberGenerator.nextBytes().toHex());
-
- String newPassword = new SimpleHash(
- algorithmName,
- user.getPassword(),
- ByteSource.Util.bytes(user.getCredentialsSalt()),
- hashIterations).toHex();
-
- user.setPassword(newPassword);
- }
-}
+package com.util;
+
+import org.apache.shiro.crypto.RandomNumberGenerator;
+import org.apache.shiro.crypto.SecureRandomNumberGenerator;
+import org.apache.shiro.crypto.hash.SimpleHash;
+import org.apache.shiro.util.ByteSource;
+import org.springframework.stereotype.Service;
+
+import com.entity.User;
+
+/**
+ *
User: Zhang Kaitao
+ *
Date: 14-1-28
+ *
Version: 1.0
+ */
+@Service
+public class PasswordHelper {
+
+ private RandomNumberGenerator randomNumberGenerator = new SecureRandomNumberGenerator();
+
+ private String algorithmName = "md5";
+ private int hashIterations = 1;
+
+ public void setRandomNumberGenerator(RandomNumberGenerator randomNumberGenerator) {
+ this.randomNumberGenerator = randomNumberGenerator;
+ }
+
+ public void setAlgorithmName(String algorithmName) {
+ this.algorithmName = algorithmName;
+ }
+
+ public void setHashIterations(int hashIterations) {
+ this.hashIterations = hashIterations;
+ }
+
+ public static void main(String[] args) {
+ PasswordHelper ph = new PasswordHelper();
+ User user = new User();
+ user.setUserId("admin");
+ user.setPassword("123456");
+ ph.encryptPassword(user);
+ System.out.println(user);
+ }
+
+ public void encryptPassword(User user) {
+
+ user.setSalt(randomNumberGenerator.nextBytes().toHex());
+
+ String newPassword = new SimpleHash(
+ algorithmName,
+ user.getPassword(),
+ ByteSource.Util.bytes(user.getCredentialsSalt()),
+ hashIterations).toHex();
+
+ user.setPassword(newPassword);
+ }
+
+ public String encryptPassword(String password,String salt) {
+ String newPassword = new SimpleHash(
+ algorithmName,
+ password,
+ ByteSource.Util.bytes(salt),
+ hashIterations).toHex();
+ return newPassword;
+ }
+}
diff --git a/src/main/java/com/util/ResultMapUtil.java b/src/main/java/com/util/ResultMapUtil.java
new file mode 100644
index 0000000..12d6020
--- /dev/null
+++ b/src/main/java/com/util/ResultMapUtil.java
@@ -0,0 +1,40 @@
+package com.util;
+
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+
+import com.google.common.collect.Maps;
+
+public class ResultMapUtil {
+ public static Map getSuccessMap() {
+ return getSuccessMap(null,null);
+ }
+ public static Map getSuccessMap(String msg) {
+ return getSuccessMap(msg,null);
+ }
+ public static Map getSuccessMap(Object obj) {
+ return getSuccessMap(null,obj);
+ }
+ public static Map getSuccessMap(String msg,Object obj) {
+ Map map = Maps.newHashMap();
+ map.put("resultCode", Constant.MSG_OK);
+ map.put("resultMsg", Constant.OK_SYS);
+ if(!StringUtils.isEmpty(msg))
+ map.put("resultMsg", msg);
+ if(obj!=null)
+ map.put("data", obj);
+ return map;
+ }
+ public static Map getFailMap() {
+ return getFailMap(null);
+ }
+ public static Map getFailMap(String msg) {
+ Map map = Maps.newHashMap();
+ map.put("resultCode", Constant.MSG_ERROR);
+ map.put("resultMsg", Constant.ERROR_SYS);
+ if(!StringUtils.isEmpty(msg))
+ map.put("resultMsg", msg);
+ return map;
+ }
+}
diff --git a/src/main/java/com/validator/Equal.java b/src/main/java/com/validator/Equal.java
new file mode 100644
index 0000000..100492e
--- /dev/null
+++ b/src/main/java/com/validator/Equal.java
@@ -0,0 +1,17 @@
+package com.validator;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.validation.Constraint;
+
+@Constraint(validatedBy = {EqualValidator.class})
+@Documented
+@Target( { ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Equal {
+ String message() default "密码不匹配不正确";
+}
diff --git a/src/main/java/com/validator/EqualValidator.java b/src/main/java/com/validator/EqualValidator.java
new file mode 100644
index 0000000..fbdb0dd
--- /dev/null
+++ b/src/main/java/com/validator/EqualValidator.java
@@ -0,0 +1,24 @@
+package com.validator;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class EqualValidator implements ConstraintValidator {
+
+ @Override
+ public void initialize(Equal constraintAnnotation) {
+
+ }
+
+ @Override
+ public boolean isValid(String[] arg0, ConstraintValidatorContext arg1) {
+ if(arg0.length!=2)
+ return false;
+ if(arg0[0]==null || arg0[1]==null)
+ return false;
+ if(!arg0[0].trim().equals(arg0[1].trim()))
+ return false;
+ return true;
+ }
+
+}
diff --git a/src/main/java/com/vm/controller/AgentController.java b/src/main/java/com/vm/controller/AgentController.java
new file mode 100644
index 0000000..e4aaa7a
--- /dev/null
+++ b/src/main/java/com/vm/controller/AgentController.java
@@ -0,0 +1,164 @@
+package com.vm.controller;
+
+import java.beans.PropertyEditorSupport;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.InitBinder;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
+
+import com.entity.Agent;
+import com.entity.enumeration.AgentLevel;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.system.service.UserBiz;
+import com.util.ResultMapUtil;
+import com.vm.service.AgentBiz;
+import com.vm.service.AreaBiz;
+
+@Controller
+@RequestMapping("agent.do")
+public class AgentController {
+ private Logger log = Logger.getLogger(AgentController.class);
+
+ @Autowired
+ private AgentBiz agentBiz;
+ @Autowired
+ private UserBiz userBiz;
+ @Autowired
+ private AreaBiz areaBiz;
+
+ @InitBinder
+ protected void initBinder(WebDataBinder binder) {
+ binder.registerCustomEditor(AgentLevel.class, new PropertyEditorSupport(){
+ @Override
+ public void setAsText(String text) throws IllegalArgumentException {
+ if(!StringUtils.isEmpty(text))
+ this.setValue(AgentLevel.valueOf(text));
+ }
+ @Override
+ public String getAsText() {
+ AgentLevel value = (AgentLevel)this.getValue();
+ return value.name();
+ }
+ });
+ }
+
+ @RequiresPermissions("agent:query")
+ @RequestMapping("agent.view")
+ public String agentView(Model model) {
+ return "forward:/agent.do/agent.view/0/10";
+ }
+
+ @RequiresPermissions("agent:query")
+ @RequestMapping("agent.view/{pageNum}/{pageSize}")
+ public String agentView(Agent agent,Model m,@PathVariable("pageNum") int pageNum,
+ @PathVariable("pageSize") int pageSize) {
+ PageHelper.startPage(pageNum, pageSize);
+ List list = agentBiz.find(agent);
+ PageInfo page = new PageInfo(list);
+ m.addAttribute("agentList", list);
+ m.addAttribute("page", page);
+ return "/vm/agent/agent";
+ }
+
+ @RequiresPermissions("agent:add")
+ @RequestMapping("agent_add.view")
+ public String agentAddView(Model m) {
+ m.addAttribute("agent", new Agent());
+ m.addAttribute("agentLevel", AgentLevel.values());
+ m.addAttribute("areaList", areaBiz.find(null));
+ m.addAttribute("userList", userBiz.findByRole("agent"));
+ return "/vm/agent/agent_add";
+ }
+
+ @RequiresPermissions("agent:update")
+ @RequestMapping("agent_update.view")
+ public String agentUpdateView(Long id,Model m) {
+ m.addAttribute("agentLevel", AgentLevel.values());
+ m.addAttribute("agent",agentBiz.findById(id));
+ m.addAttribute("areaList", areaBiz.find(null));
+ m.addAttribute("userList", userBiz.findByRole("agent"));
+ return "/vm/agent/agent_update";
+ }
+
+ @RequiresPermissions("agent:add")
+ @RequestMapping("add")
+ public String add(Agent agent) {
+ agentBiz.add(agent);
+ return "redirect:/agent.do/agent.view";
+ }
+
+ @RequiresPermissions("agent:update")
+ @RequestMapping("update")
+ public String update(Agent agent) {
+ agentBiz.update(agent);
+ return "redirect:/agent.do/agent.view";
+ }
+
+ @RequiresPermissions("agent:delete")
+ @RequestMapping("delete")
+ public String delete(Long id) {
+ agentBiz.delete(id);
+ return "redirect:/agent.do/agent.view";
+ }
+
+
+ @SuppressWarnings("resource")
+ @RequiresPermissions("agent:import")
+ @RequestMapping("import")
+ @ResponseBody
+ @Transactional()
+ public Map imp(@RequestParam("file") CommonsMultipartFile file){
+ Workbook wb = null;
+ try {
+ boolean isExcel2007 = file.getOriginalFilename().matches("^.+\\.(?i)(xlsx)$");
+ if(isExcel2007) {
+ wb = new XSSFWorkbook(file.getInputStream());
+ } else {
+ wb = new HSSFWorkbook(file.getInputStream());
+ }
+ Sheet sheet = wb.getSheetAt(0);
+ int rowNum = sheet.getLastRowNum();
+ for(int i=1;i<=rowNum;i++) {
+ Row row = sheet.getRow(i);
+ String level = row.getCell(0).getStringCellValue();
+ AgentLevel agentLevel = AgentLevel.parse(level);
+ String agentName = row.getCell(1).getStringCellValue();
+ if(StringUtils.isEmpty(agentName)) continue;
+ String area = row.getCell(2).getStringCellValue();
+ String openid = row.getCell(3).getStringCellValue();
+ Agent agent = new Agent(agentLevel,agentName,area,openid);
+
+ agentBiz.add(agent);
+ }
+ } catch(NullPointerException e) {
+ log.error("上传文件解析失败",e);
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ return ResultMapUtil.getFailMap("字段不允许为空");
+ } catch (IOException e) {
+ log.error("上传文件解析失败",e);
+ return ResultMapUtil.getFailMap();
+ }
+ return ResultMapUtil.getSuccessMap();
+ }
+}
diff --git a/src/main/java/com/vm/controller/AreaController.java b/src/main/java/com/vm/controller/AreaController.java
new file mode 100644
index 0000000..3a963dd
--- /dev/null
+++ b/src/main/java/com/vm/controller/AreaController.java
@@ -0,0 +1,76 @@
+package com.vm.controller;
+
+import java.util.List;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.entity.Area;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.vm.service.AreaBiz;
+
+@Controller
+@RequestMapping("area.do")
+public class AreaController {
+
+ @Autowired
+ private AreaBiz areaBiz;
+
+ @RequiresPermissions("area:query")
+ @RequestMapping("area.view")
+ public String areaView(Model model) {
+ return "forward:/area.do/area.view/0/10";
+ }
+
+ @RequiresPermissions("area:query")
+ @RequestMapping("area.view/{pageNum}/{pageSize}")
+ public String areaView(Area area,Model m,@PathVariable("pageNum") int pageNum,
+ @PathVariable("pageSize") int pageSize) {
+ PageHelper.startPage(pageNum, pageSize);
+ List list = areaBiz.find(area);
+ PageInfo page = new PageInfo(list);
+ m.addAttribute("areaList", list);
+ m.addAttribute("page", page);
+ return "/vm/area/area";
+ }
+
+ @RequiresPermissions("area:add")
+ @RequestMapping("area_add.view")
+ public String areaAddView(Model m) {
+ m.addAttribute("area", new Area());
+ return "/vm/area/area_add";
+ }
+
+ @RequiresPermissions("area:update")
+ @RequestMapping("area_update.view")
+ public String areaUpdateView(Long id,Model m) {
+ m.addAttribute("area",areaBiz.findById(id));
+ return "/vm/area/area_update";
+ }
+
+ @RequiresPermissions("area:add")
+ @RequestMapping("add")
+ public String add(Area area) {
+ areaBiz.add(area);
+ return "redirect:/area.do/area.view";
+ }
+
+ @RequiresPermissions("area:update")
+ @RequestMapping("update")
+ public String update(Area area) {
+ areaBiz.update(area);
+ return "redirect:/area.do/area.view";
+ }
+
+ @RequiresPermissions("area:delete")
+ @RequestMapping("delete")
+ public String delete(Long id) {
+ areaBiz.delete(id);
+ return "redirect:/area.do/area.view";
+ }
+}
diff --git a/src/main/java/com/vm/controller/CarController.java b/src/main/java/com/vm/controller/CarController.java
new file mode 100644
index 0000000..253efce
--- /dev/null
+++ b/src/main/java/com/vm/controller/CarController.java
@@ -0,0 +1,138 @@
+package com.vm.controller;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+import org.springframework.ui.Model;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
+
+import com.entity.Car;
+import com.entity.Standard;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.util.ResultMapUtil;
+import com.vm.service.CarBiz;
+import com.vm.service.StandardBiz;
+
+@Controller
+@RequestMapping("car.do")
+public class CarController {
+ private Logger log = Logger.getLogger(CarController.class);
+
+ @Autowired
+ private CarBiz carBiz;
+ @Autowired
+ private StandardBiz standardBiz;
+
+ @RequiresPermissions("car:query")
+ @RequestMapping("car.view")
+ public String carView(Model model) {
+ return "forward:/car.do/car.view/0/10";
+ }
+
+ @RequiresPermissions("car:query")
+ @RequestMapping("car.view/{pageNum}/{pageSize}")
+ public String CarView(Car car,Model m,@PathVariable("pageNum") int pageNum,
+ @PathVariable("pageSize") int pageSize) {
+ PageHelper.startPage(pageNum, pageSize);
+ List list = carBiz.find(car);
+ PageInfo page = new PageInfo(list);
+ m.addAttribute("carList", list);
+ m.addAttribute("page", page);
+ return "/vm/car/car";
+ }
+
+ @RequiresPermissions("car:add")
+ @RequestMapping("car_add.view")
+ public String carAddView(Model m) {
+ m.addAttribute("standardList", standardBiz.find(new Standard()));
+ return "/vm/car/car_add";
+ }
+
+ @RequiresPermissions("car:update")
+ @RequestMapping("car_update.view")
+ public String carUpdateView(Long id,Model m) {
+ m.addAttribute("standardList", standardBiz.find(new Standard()));
+ m.addAttribute("car",carBiz.findById(id));
+ return "/vm/car/car_update";
+ }
+
+ @RequiresPermissions("car:add")
+ @RequestMapping("add")
+ public String add(Car car) {
+ carBiz.add(car);
+ return "redirect:/car.do/car.view";
+ }
+
+ @RequiresPermissions("car:update")
+ @RequestMapping("update")
+ public String update(Car car) {
+ carBiz.update(car);
+ return "redirect:/car.do/car.view";
+ }
+
+ @RequiresPermissions("car:delete")
+ @RequestMapping("delete")
+ public String delete(Long id) {
+ carBiz.delete(id);
+ return "redirect:/car.do/car.view";
+ }
+
+ @SuppressWarnings("resource")
+ @RequiresPermissions("car:import")
+ @RequestMapping("import")
+ @ResponseBody
+ @Transactional()
+ public Map imp(@RequestParam("file") CommonsMultipartFile file){
+ Workbook wb = null;
+ try {
+ boolean isExcel2007 = file.getOriginalFilename().matches("^.+\\.(?i)(xlsx)$");
+ if(isExcel2007) {
+ wb = new XSSFWorkbook(file.getInputStream());
+ } else {
+ wb = new HSSFWorkbook(file.getInputStream());
+ }
+ Sheet sheet = wb.getSheetAt(0);
+ int rowNum = sheet.getLastRowNum();
+ for(int i=1;i<=rowNum;i++) {
+ Row row = sheet.getRow(i);
+ String carId = row.getCell(0).getStringCellValue();
+ if(StringUtils.isEmpty(carId)) continue;
+ Boolean isSale = row.getCell(1).getBooleanCellValue();
+ Integer high = (int) row.getCell(2).getNumericCellValue();
+ Integer length = (int) row.getCell(3).getNumericCellValue();
+ Integer wide = (int) row.getCell(4).getNumericCellValue();
+ Integer weight = (int) row.getCell(5).getNumericCellValue();
+
+ Car car = new Car(carId,isSale,high,length,wide,weight);
+ carBiz.add(car);
+ }
+ } catch(NullPointerException e) {
+ log.error("上传文件解析失败",e);
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ return ResultMapUtil.getFailMap("字段不允许为空");
+ } catch (IOException e) {
+ log.error("上传文件解析失败",e);
+ return ResultMapUtil.getFailMap();
+ }
+ return ResultMapUtil.getSuccessMap();
+ }
+
+}
diff --git a/src/main/java/com/vm/controller/OrderController.java b/src/main/java/com/vm/controller/OrderController.java
new file mode 100644
index 0000000..f4902aa
--- /dev/null
+++ b/src/main/java/com/vm/controller/OrderController.java
@@ -0,0 +1,173 @@
+package com.vm.controller;
+
+import java.beans.PropertyEditorSupport;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+import org.springframework.ui.Model;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.InitBinder;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
+
+import com.entity.Agent;
+import com.entity.Car;
+import com.entity.Order;
+import com.entity.enumeration.OrderType;
+import com.entity.enumeration.Status;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.util.ResultMapUtil;
+import com.vm.service.AgentBiz;
+import com.vm.service.CarBiz;
+import com.vm.service.OrderBiz;
+
+@Controller
+@RequestMapping("order.do")
+public class OrderController {
+ private Logger log = Logger.getLogger(OrderController.class);
+
+ @Autowired
+ private OrderBiz orderBiz;
+ @Autowired
+ private CarBiz carBiz;
+ @Autowired
+ private AgentBiz agentBiz;
+
+
+ @InitBinder
+ protected void initBinder(WebDataBinder binder) {
+ binder.registerCustomEditor(OrderType.class, new PropertyEditorSupport(){
+ @Override
+ public void setAsText(String text) throws IllegalArgumentException {
+ if(!StringUtils.isEmpty(text))
+ this.setValue(OrderType.valueOf(text));
+ }
+ @Override
+ public String getAsText() {
+ OrderType value = (OrderType)this.getValue();
+ return value.name();
+ }
+ });
+ }
+
+ @RequiresPermissions("order:query")
+ @RequestMapping("order.view")
+ public String orderView(Model model) {
+ return "forward:/order.do/order.view/0/10";
+ }
+
+ @RequiresPermissions("order:query")
+ @RequestMapping("order.view/{pageNum}/{pageSize}")
+ public String orderView(Order order,Model m,@PathVariable("pageNum") int pageNum,
+ @PathVariable("pageSize") int pageSize) {
+ PageHelper.startPage(pageNum, pageSize);
+ List list = orderBiz.find(order);
+ PageInfo page = new PageInfo(list);
+ m.addAttribute("orderList", list);
+ m.addAttribute("page", page);
+ return "/vm/order/order";
+ }
+
+ @RequestMapping("external/order_add.view")
+ public String orderAddView(ModelMap m) {
+ String openid = (String) m.get("openid");
+ String orderType = (String) m.get("orderType");
+ if(StringUtils.isEmpty(openid)) {
+ openid = "test";
+ m.put("openid", openid);
+ }
+ if(StringUtils.isEmpty(orderType)) {
+ orderType = OrderType.DISTRIBUTION.name();
+ m.put("orderType", orderType);
+ }
+ Agent agent = agentBiz.findByOpenId(openid);
+ List carList = carBiz.findByLevel(agent.getLevel());
+ m.put("carList", carList);
+ return "/vm/order/external_order_add";
+ }
+
+ @RequestMapping("external/add")
+ public String add(Order order) {
+ order.setStatus(Status.START);
+ orderBiz.add(order);
+ return "/vm/order/external_order_add_success";
+ }
+
+ @RequiresPermissions("order:update")
+ @RequestMapping("order_update.view")
+ public String orderUpdateView(Long id,Model m) {
+ m.addAttribute("order",orderBiz.findById(id));
+ return "/vm/order/order_update";
+ }
+
+
+ @RequiresPermissions("order:update")
+ @RequestMapping("update")
+ public String update(Order order) {
+ orderBiz.update(order);
+ return "redirect:/order.do/order.view";
+ }
+
+ @RequiresPermissions("order:delete")
+ @RequestMapping("delete")
+ public String delete(Long id) {
+ orderBiz.delete(id);
+ return "redirect:/order.do/order.view";
+ }
+
+
+ @SuppressWarnings("resource")
+ @RequiresPermissions("order:import")
+ @RequestMapping("import")
+ @ResponseBody
+ @Transactional()
+ public Map imp(@RequestParam("file") CommonsMultipartFile file){
+ Workbook wb = null;
+ try {
+ boolean isExcel2007 = file.getOriginalFilename().matches("^.+\\.(?i)(xlsx)$");
+ if(isExcel2007) {
+ wb = new XSSFWorkbook(file.getInputStream());
+ } else {
+ wb = new HSSFWorkbook(file.getInputStream());
+ }
+ Sheet sheet = wb.getSheetAt(0);
+ int rowNum = sheet.getLastRowNum();
+ for(int i=1;i<=rowNum;i++) {
+ Row row = sheet.getRow(i);
+ String level = row.getCell(0).getStringCellValue();
+ String orderName = row.getCell(1).getStringCellValue();
+ if(StringUtils.isEmpty(orderName)) continue;
+ String area = row.getCell(2).getStringCellValue();
+ Order order = new Order();
+
+ orderBiz.add(order);
+ }
+ } catch(NullPointerException e) {
+ log.error("上传文件解析失败",e);
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ return ResultMapUtil.getFailMap("字段不允许为空");
+ } catch (IOException e) {
+ log.error("上传文件解析失败",e);
+ return ResultMapUtil.getFailMap();
+ }
+ return ResultMapUtil.getSuccessMap();
+ }
+}
diff --git a/src/main/java/com/vm/controller/ProcurementController.java b/src/main/java/com/vm/controller/ProcurementController.java
new file mode 100644
index 0000000..5af951a
--- /dev/null
+++ b/src/main/java/com/vm/controller/ProcurementController.java
@@ -0,0 +1,95 @@
+package com.vm.controller;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.log4j.Logger;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.entity.Procurement;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.vm.service.FileUploadBiz;
+import com.vm.service.ProcurementBiz;
+
+@Controller
+@RequestMapping("procurement.do")
+public class ProcurementController {
+ private Logger log = Logger.getLogger(ProcurementController.class);
+
+ @Autowired
+ private ProcurementBiz procBiz;
+ @Autowired
+ private FileUploadBiz fileUpload;
+
+ @RequiresPermissions("procurement:query")
+ @RequestMapping("procurement.view")
+ public String ProcurementViewForword(Model model) {
+ return "forward:/procurement.do/procurement.view/0/10";
+ }
+
+ @RequiresPermissions("procurement:query")
+ @RequestMapping("procurement.view/{pageNum}/{pageSize}")
+ public String ProcurementView(Procurement procurement,Model m,@PathVariable("pageNum") int pageNum,
+ @PathVariable("pageSize") int pageSize) {
+
+ PageHelper.startPage(pageNum, pageSize);
+ List list = procBiz.find(procurement);
+ PageInfo page = new PageInfo(list);
+ m.addAttribute("procurementList", list);
+ m.addAttribute("page", page);
+ return "/vm/procurement/procurement";
+ }
+
+ @RequiresPermissions("procurement:add")
+ @RequestMapping("procurement_add.view")
+ public String procurementAddView(Model m) {
+
+ return "/vm/procurement/procurement_add";
+ }
+ @RequiresPermissions("procurement:add")
+ @RequestMapping("add")
+ public String add(Procurement procurement) {
+ procBiz.add(procurement);
+ return "redirect:/procurement.do/procurement.view";
+ }
+
+ @RequiresPermissions("procurement:update")
+ @RequestMapping("procurement_update.view")
+ public String procurementUpdateView(Long id,Model m) {
+ m.addAttribute("procurement",procBiz.findById(id));
+ return "/vm/procurement/procurement_update";
+ }
+
+ @RequiresPermissions("procurement:update")
+ @RequestMapping("update")
+ public String update(Procurement procurement) {
+ procBiz.update(procurement);
+ return "redirect:/procurement.do/procurement.view";
+ }
+
+ @RequiresPermissions("procurement:delete")
+ @RequestMapping("delete")
+ public String delete(Long id) {
+ procBiz.delete(id);
+ return "redirect:/procurement.do/procurement.view";
+ }
+
+ @RequiresPermissions("procurement:import")
+ @RequestMapping("import")
+ @ResponseBody
+ @Transactional()
+ public Map imp(HttpServletRequest request){
+
+ return fileUpload.fileUploadFile(request);
+ }
+}
diff --git a/src/main/java/com/vm/controller/StandardController.java b/src/main/java/com/vm/controller/StandardController.java
new file mode 100644
index 0000000..dbe491a
--- /dev/null
+++ b/src/main/java/com/vm/controller/StandardController.java
@@ -0,0 +1,76 @@
+package com.vm.controller;
+
+import java.util.List;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.entity.Standard;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.vm.service.StandardBiz;
+
+@Controller
+@RequestMapping("standard.do")
+public class StandardController {
+
+ @Autowired
+ private StandardBiz standardBiz;
+
+ @RequiresPermissions("standard:query")
+ @RequestMapping("standard.view")
+ public String standardView(Model model) {
+ return "forward:/standard.do/standard.view/0/10";
+ }
+
+ @RequiresPermissions("standard:query")
+ @RequestMapping("standard.view/{pageNum}/{pageSize}")
+ public String standardView(Standard standard,Model m,@PathVariable("pageNum") int pageNum,
+ @PathVariable("pageSize") int pageSize) {
+ PageHelper.startPage(pageNum, pageSize);
+ List list = standardBiz.find(standard);
+ PageInfo page = new PageInfo(list);
+ m.addAttribute("standardList", list);
+ m.addAttribute("page", page);
+ return "/vm/standard/standard";
+ }
+
+ @RequiresPermissions("standard:add")
+ @RequestMapping("standard_add.view")
+ public String standardAddView(Model m) {
+ return "/vm/standard/standard_add";
+ }
+
+ @RequiresPermissions("standard:update")
+ @RequestMapping("standard_update.view")
+ public String standardUpdateView(Long id,Model m) {
+ m.addAttribute("standard",standardBiz.findById(id));
+ return "/vm/standard/standard_update";
+ }
+
+ @RequiresPermissions("standard:add")
+ @RequestMapping("add")
+ public String add(Standard standard) {
+ standardBiz.add(standard);
+ return "redirect:/standard.do/standard.view";
+ }
+
+ @RequiresPermissions("standard:update")
+ @RequestMapping("update")
+ public String update(Standard standard) {
+ standardBiz.update(standard);
+ return "redirect:/standard.do/standard.view";
+ }
+
+ @RequiresPermissions("standard:delete")
+ @RequestMapping("delete")
+ public String delete(Long standardId) {
+ standardBiz.delete(standardId);
+ return "redirect:/standard.do/standard.view";
+ }
+
+}
diff --git a/src/main/java/com/vm/controller/UploadController.java b/src/main/java/com/vm/controller/UploadController.java
new file mode 100644
index 0000000..a6b877c
--- /dev/null
+++ b/src/main/java/com/vm/controller/UploadController.java
@@ -0,0 +1,95 @@
+package com.vm.controller;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.entity.FileInfo;
+import com.util.ResultMapUtil;
+import com.vm.service.FileUploadBiz;
+
+
+@Controller
+@RequestMapping("upload.do")
+public class UploadController {
+ private Logger log = Logger.getLogger(UploadController.class);
+
+ @Autowired
+ private FileUploadBiz fileUpload;
+
+
+ /**
+ * 上传文件
+ *
+ * @param request
+ * @return
+ */
+ @RequestMapping("file")
+ @ResponseBody
+ public Map uploadFile(HttpServletRequest request) {
+ return fileUpload.fileUploadFile(request);
+ }
+
+ /**
+ * 上传图片
+ *
+ * @param request
+ * @return
+ */
+ @RequestMapping("image")
+ @ResponseBody
+ public Map uploadImage(HttpServletRequest request) {
+ return fileUpload.fileUploadImage(request);
+ }
+
+ /**
+ * 多文件上传
+ *
+ * @param request
+ * @return
+ */
+ @RequestMapping("multiple")
+ @ResponseBody
+ public Map uploadMultiple(HttpServletRequest request) {
+ return fileUpload.uploadMultiple(request);
+ }
+
+ @RequestMapping("delete")
+ @ResponseBody
+ public Map delete(Long id) {
+ try {
+ fileUpload.delete(id);
+ } catch(Exception e) {
+ log.error("DeleteError",e);
+ return ResultMapUtil.getFailMap();
+ }
+ return ResultMapUtil.getSuccessMap();
+ }
+
+
+ @RequestMapping("query")
+ @ResponseBody
+ public Map query(Long id) {
+ FileInfo fileInfo = fileUpload.query(id);
+ return ResultMapUtil.getSuccessMap(fileInfo);
+ }
+
+ @RequestMapping("queryByIds")
+ @ResponseBody
+ public Map query(String ids) {
+ try {
+ List list = fileUpload.query(ids);
+ return ResultMapUtil.getSuccessMap(list);
+ } catch(Exception e) {
+ log.error("QueryError",e);
+ return ResultMapUtil.getFailMap();
+ }
+ }
+}
diff --git a/src/main/java/com/vm/controller/VendorController.java b/src/main/java/com/vm/controller/VendorController.java
new file mode 100644
index 0000000..bc4de71
--- /dev/null
+++ b/src/main/java/com/vm/controller/VendorController.java
@@ -0,0 +1,76 @@
+package com.vm.controller;
+
+import java.util.List;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.entity.Vendor;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.vm.service.VendorBiz;
+
+@Controller
+@RequestMapping("vendor.do")
+public class VendorController {
+
+ @Autowired
+ private VendorBiz vendorBiz;
+
+ @RequiresPermissions("vendor:query")
+ @RequestMapping("vendor.view")
+ public String vendorView(Model model) {
+ return "forward:/vendor.do/vendor.view/0/10";
+ }
+
+ @RequiresPermissions("vendor:query")
+ @RequestMapping("vendor.view/{pageNum}/{pageSize}")
+ public String vendorView(Vendor vendor,Model m,@PathVariable("pageNum") int pageNum,
+ @PathVariable("pageSize") int pageSize) {
+ PageHelper.startPage(pageNum, pageSize);
+ List list = vendorBiz.find(vendor);
+ PageInfo